Files
yavsc/web/Controllers/FrontOfficeApiController.cs
Paul Schneider f157c6edb9 * Web.csproj:
* jquery-latest.js:
* IITContent.cs:
* ITContent.csproj:
* YavscModel.csproj:
* Write.aspx:
* jquery.tablesorter.min.js:
* AssemblyInfo.cs:
* NewEstimateEvenArgs.cs: 

* jquery.metadata.js: ajax call Write

* jquery.tablesorter.js: Estimate table sorting

* Catalog.cs: Find a product by reference

* NpgsqlContentProvider.cs: Npgsql provider could not get the
  Postgresql data type "money"

* Yavsc.sln: Removing an empty project

* MyClass.cs: implements IModule

* fortune.csproj: uses Configuration

* FrontOfficeApiController.cs: Url: GetEstimate/5

* WorkFlowController.cs: debugging ajax call

* RemoveUserQuery.aspx: no more "head" place holder


* Estimate.aspx: Ajax call to add a line to estimates

* Web.config: using the "Deploy" target

* IModule.cs: Install & uninstall using a System.Data.IDbConnection

* IContentProvider.cs: refactoring

* WorkFlowManager.cs: an event at creating an estimate (NewOrder)

* Writting.cs: ProductReference is a string
2014-10-17 02:10:00 +02:00

83 lines
1.8 KiB
C#

using System;
using Yavsc;
using SalesCatalog;
using SalesCatalog.Model;
using System.Web.Routing;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Web.Http;
using System.Net.Http;
using System.Web;
using System.Linq;
using System.IO;
using System.Net;
using WorkFlowProvider;
using System.Web.Security;
using Yavsc.Model.WorkFlow;
namespace Yavsc.ApiControllers
{
public class FrontOfficeController : ApiController
{
[AcceptVerbs("GET")]
public Catalog Catalog ()
{
Catalog c = CatalogManager.GetCatalog ();
return c;
}
[AcceptVerbs("GET")]
public ProductCategory GetProductCategorie (string brandName, string prodCategorie)
{
return CatalogManager.GetCatalog ().GetBrand (brandName).GetProductCategory (prodCategorie)
;
}
/*
public HttpResponseMessage Post()
{
HttpResponseMessage result = null;
var httpRequest = HttpContext.Current.Request;
if (httpRequest.Files.Count > 0)
{
string username = HttpContext.Current.User.Identity.Name;
int nbf = 0;
foreach(string file in httpRequest.Files)
{
var postedFile = httpRequest.Files[file];
string filePath = HttpContext.Current.Server.MapPath("~/users/"+username+"/"+ postedFile.FileName);
postedFile.SaveAs(filePath);
nbf++;
}
result = Request.CreateResponse <string>(HttpStatusCode.Created,
string.Format("Received {0} files",nbf));
}
else
{
result = Request.CreateResponse <string>(HttpStatusCode.BadRequest,"No file received");
}
return result;
}
*/
[Authorize]
[HttpGet]
/// <summary>
/// Gets the estimate.
/// </summary>
/// <returns>The estimate.</returns>
/// <param name="estid">Estid.</param>
public Estimate GetEstimate (long Id)
{
Estimate est = WorkFlowManager.ContentProvider.GetEstimate (Id);
return est;
}
}
}