public long Add(Uom obj) { if (IsDuplicate(obj.Code, obj.Id, obj.CustomerId) == false) { return(_uomRepository.Add(obj)); } else { Expression <Func <Uom, bool> > res = x => x.Code == obj.Code && x.CustomerId == obj.CustomerId && x.IsActive == false; var model = _uomRepository.Get(res); if (model != null) { obj.Id = model.Id; obj.IsActive = true; _uomRepository.Detach(model); _uomRepository.Update(obj); return(obj.Id); } else { return(0); } } }
public IHttpActionResult Put([FromODataUri] System.Guid key, [FromBody] Uom entity) { logger.Trace("Call UomController Put"); var record = uomRepository.Update(entity); return(Updated(record)); }