public ActionResult Update([FromBody] FeatDto featDto) { featDto.Created = DateTime.Now; bool update = _featLogic.Update(featDto.Id, featDto); if (update == true) { return(Ok()); } else { return(BadRequest()); } }
public override FeatDto Create(FeatDto entity) { using (var scope = Repository.DatabaseFacade.BeginTransaction()) { if (entity.FromUser.Equals(entity.ToUser)) { throw new BusinessException(ExceptionCode.SendingFeatsToYourself); } var item = Mapper.Map <Feat>(entity); Repository.Create(item); Repository.SaveChanges(); scope.Commit(); } return(entity); }
public bool Update(Guid entityId, FeatDto entity) { var success = false; if (entity != null) { using (var scope = Repository.DatabaseFacade.BeginTransaction()) { var product = Repository.GetByID(entityId); if (product != null) { var item = Mapper.Map(entity, product); Repository.Update(item); Repository.SaveChanges(); scope.Commit(); success = true; } } } return(success); }
async public Task <ActionResult> Post([FromBody] FeatDto featDto) { featDto.Created = DateTime.Now; _featLogic.Create(featDto); return(Ok()); }