public void Add(CowVm model) { var user = _userRepo.FindBy(x => x.Email.Equals(model.Email)).FirstOrDefault(); if (user != null) model.UserId = user.Id; model.MotherId = null; _repository.Add(Mapper.Map<Cow>(model)); _repository.Save(); }
public IHttpActionResult Put(CowVm model) { try { _businessLogic.Update(model); return Ok(); } catch (Exception ex) { return InternalServerError(ex); } }
public IHttpActionResult Post(CowVm model) { try { model.Id = Guid.NewGuid(); _businessLogic.Add(model); return Ok(model.Id); } catch (Exception ex) { return InternalServerError(ex); } }
public void Update(CowVm model) { _repository.Update(Mapper.Map<Cow>(model)); _repository.Save(); }