public IHttpActionResult UpdateLookUpValue(MasterCurrencyFile data) { if (data != null) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var record = entity.CurrencyFiles.Where(x => x.CurrCode == data.CurrCode).First(); record.Country = data.Country; record.SwiftCode = data.SwiftCode; record.XRate = data.XRate; record.EdtDt = data.EdtDt; try { entity.SaveChanges(); } catch (DbUpdateConcurrencyException) { throw; } } return(Ok(data)); }
public IHttpActionResult DeleteLookUpValue(MasterCurrencyFile data) { var record = entity.CurrencyFiles.Where(x => x.CurrCode == data.CurrCode).First(); if (record == null) { return(NotFound()); } entity.CurrencyFiles.Remove(record); entity.SaveChanges(); return(Ok(record)); }
public IHttpActionResult SaveLookUpValue(MasterCurrencyFile data) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } entity.CurrencyFiles.Add(new CurrencyFile { Country = data.Country, SwiftCode = data.SwiftCode, CurrCode = data.CurrCode, XRate = data.XRate, EdtDt = data.EdtDt }); entity.SaveChanges(); return(Ok(data)); }