* T.cs: * IModule.cs: * App.master: * IProvider.cs: * Error.aspx: * AOEMail.aspx: * Login.aspx: * Index.aspx: * Admin.aspx: * yavscModel.csproj: * WFManager.cs: * Index.aspx: * AddRole.aspx: * Profile.aspx: * Edit.aspx: * Register.aspx: * Index.aspx: * RoleList.aspx: * UserList.aspx: * Validate.aspx: * RemovePost.aspx: * Index.aspx: * BasketImpact.cs: * Brand.aspx: * Delete.aspx: * Create.aspx: * Backups.aspx: * HomeController.cs: * BlogManager.cs: * Restore.aspx: * Details.aspx: * TitleNotFound.aspx: * Product.aspx: * AdminController.cs: * Command.aspx: * Service.aspx: * BlogProvider.cs: * NewProject.aspx: * Catalog.aspx: * Restored.aspx: * BasketController.cs: * AccountController.cs: * WorkFlowController.cs: * BlogsApiController.cs: * ChangePassword.aspx: * RemoveRoleQuery.aspx: * CreateBackup.aspx: * IContentProvider.cs: * BackOfficeController.cs: * FrontOfficeController.cs: * NpgsqlBlogProvider.cs: * NpgsqlContentProvider.cs: * RegistrationPending.aspx: * ProductCategory.aspx: * FrontOfficeApiController.cs: * ChangePasswordSuccess.aspx: * ReferenceNotFound.aspx: * BackupCreated.aspx Fixes many HTTP 500 Refactoring on the go
87 lines
1.9 KiB
C#
87 lines
1.9 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 yavscModel.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)
|
|
;
|
|
}
|
|
|
|
[AcceptVerbs("GET","POST")]
|
|
public string Command()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
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 estid)
|
|
{
|
|
Estimate est = WFManager.ContentProvider.GetEstimate (estid);
|
|
return est;
|
|
}
|
|
|
|
}
|
|
}
|
|
|