public string SaveChanges(string jsonString) { try { JsonSerializerSettings st = new JsonSerializerSettings(); st.DateTimeZoneHandling = DateTimeZoneHandling.Local; ReturnFeeEntity entity = JsonConvert.DeserializeObject <ReturnFeeEntity>(jsonString, st); ReturnFeeManager service = new ReturnFeeManager(); if (string.IsNullOrEmpty(entity.iGuid)) { entity.iCreatedBy = SessionHelper.CurrentUser.UserName; entity.iUpdatedBy = SessionHelper.CurrentUser.UserName; service.Insert(entity); } else { entity.iUpdatedBy = SessionHelper.CurrentUser.UserName; service.Update(entity); } return("success"); } catch (Exception e) { return(e.ToString()); } }
private void MergeToDB(List <ReturnFeeEntity> list) { ReturnFeeManager service = new ReturnFeeManager(); foreach (var item in list) { if (string.IsNullOrEmpty(item.iGuid)) { item.iCreatedBy = SessionHelper.CurrentUser.UserName; item.iUpdatedBy = SessionHelper.CurrentUser.UserName; service.Insert(item); } else { item.iUpdatedBy = SessionHelper.CurrentUser.UserName; service.Update(item); } } }