public async Task <HttpResponseMessage> Update([FromUri] int id, [FromBody] EditWorkspaceTemplateModel model) { Log.Out.BeginInfo(model.ToJson(), "UpdateWorkspaceTemplate - Id: {0}", id); await Service.Get <ITemplateService>().UpdateWorkspaceTemplate(id, model); Log.Out.EndInfo("UpdateWorkspaceTemplate - Id: {0}", id); return(Request.CreateResponse(HttpStatusCode.OK)); }
public async Task <HttpResponseMessage> Add([FromBody] EditWorkspaceTemplateModel model) { Log.Out.BeginInfo(model.ToJson(), "AddWorkspaceTemplate"); var id = await Service.Get <ITemplateService>().AddWorkspaceTemplate(model); Log.Out.EndInfo("AddWorkspaceTemplate - Id: {0}", id); return(Request.CreateResponse(HttpStatusCode.OK, new { Id = id })); }
public Task UpdateWorkspaceTemplate(int id, EditWorkspaceTemplateModel model) { return(Update <WorkspaceTemplate, IWorkspaceTemplateRepository>(id, template => { var entity = model.GetEntity(); template.Name = entity.Name; template.ModificationTime = entity.ModificationTime; template.ModifiedByUserId = entity.ModifiedByUserId; })); }
public Task <int> AddWorkspaceTemplate(EditWorkspaceTemplateModel model) { return(Add <WorkspaceTemplate, IWorkspaceTemplateRepository>(template => template.Id, model.GetEntity)); }