* 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
106 lines
2.2 KiB
C#
106 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
using System.Web.Http;
|
|
using WorkFlowProvider;
|
|
using yavscModel.WorkFlow;
|
|
using System.Web.Http.Controllers;
|
|
using System.Web.Security;
|
|
|
|
namespace Yavsc.ApiControllers
|
|
{
|
|
[HttpControllerConfiguration(ActionValueBinder=typeof(Basic.MvcActionValueBinder))]
|
|
public class WorkFlowController : ApiController
|
|
{
|
|
string adminRoleName="Admin";
|
|
|
|
protected override void Initialize (HttpControllerContext controllerContext)
|
|
{
|
|
base.Initialize (controllerContext);
|
|
if (!Roles.RoleExists (adminRoleName)) {
|
|
Roles.CreateRole (adminRoleName);
|
|
}
|
|
}
|
|
|
|
[HttpGet]
|
|
[Authorize]
|
|
public long CreateEstimate (string title)
|
|
{
|
|
return WFManager.CreateEstimate (
|
|
Membership.GetUser().UserName,title);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Authorize]
|
|
public void DropWritting(long wrid)
|
|
{
|
|
WFManager.DropWritting (wrid);
|
|
}
|
|
[HttpGet]
|
|
[Authorize]
|
|
public void UpdateWritting(Writting wr)
|
|
{
|
|
WFManager.UpdateWritting (wr);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Authorize]
|
|
public void DropEstimate(long estid)
|
|
{
|
|
WFManager.DropEstimate (estid);
|
|
}
|
|
[HttpGet]
|
|
[Authorize]
|
|
public object Index()
|
|
{
|
|
// TODO inform user on its roles and alerts
|
|
string username = Membership.GetUser ().UserName;
|
|
return new { test=string.Format("Hello {0}!",username) };
|
|
}
|
|
|
|
|
|
|
|
[HttpGet]
|
|
[Authorize]
|
|
public long Write (long estid, string desc, decimal ucost, int count, long productid=0) {
|
|
// TODO ensure estid owner matches the current one
|
|
|
|
return WFManager.Write(estid, desc, ucost, count, productid);
|
|
}
|
|
|
|
|
|
/*
|
|
public object Details(int id)
|
|
{
|
|
throw new NotImplementedException ();
|
|
}
|
|
|
|
public object Create()
|
|
{
|
|
throw new NotImplementedException ();
|
|
}
|
|
|
|
public object Edit(int id)
|
|
{
|
|
throw new NotImplementedException ();
|
|
}
|
|
|
|
public object Delete(int id)
|
|
{
|
|
throw new NotImplementedException ();
|
|
}
|
|
|
|
IContentProvider contentProvider = null;
|
|
IContentProvider ContentProvider {
|
|
get {
|
|
if (contentProvider == null )
|
|
contentProvider = WFManager.GetContentProviderFWC ();
|
|
return contentProvider;
|
|
}
|
|
}
|
|
|
|
*/
|
|
}
|
|
}
|