public Content AddContent(Content aContent) { using (var tran = Repository.BeginTran()) { var entity = Repository.Create(_simpleMapper.Map<Content, Data.Entities.ContentObject>(aContent)); aContent.Id = entity.Id; tran.Commit(); } return aContent; }
public Content Put(int id, Content content) { content.Id = id; return ContentService.SaveContent(content); }
public Content Post(Content content) { return ContentService.AddContent(content); }
public Content SaveContent(Content aContent) { using (var tran = Repository.BeginTran()) { var entity = Repository.Get().Single(x => x.Id == aContent.Id); entity.Description = aContent.Description; entity.Name = aContent.Name; entity = Repository.Save(entity); tran.Commit(); return _simpleMapper.Map<Data.Entities.ContentObject, Content>(entity); } }