public string UpdateEntity(ClassMasterVm entity) { var result = ConvertSourceToDest <ClassMasterVm, Class> .ConvertSourceToDestination(entity); dB_SPADevelopementEntities.Entry(result).State = System.Data.Entity.EntityState.Modified; dB_SPADevelopementEntities.SaveChanges(); return("Class Updated SuccessFully"); }
public string InsertEntity(ClassMasterVm entity) { entity.CreatedDate = System.DateTime.Now.Date; var result = ConvertSourceToDest <ClassMasterVm, Class> .ConvertSourceToDestination(entity); dB_SPADevelopementEntities.Classes.Add(result); dB_SPADevelopementEntities.SaveChanges(); return("Class Created SuccessFully"); }
public JsonResult PostClassEdit(ClassMasterVm classMasterVm) { if (TempData["id"] == null || Convert.ToInt32(TempData["id"]) == 0) { classMasterVm.IsActive = 1; classMasterVm.UpdatedBy = 1; classMasterVm.UpdatedDate = DateTime.Now.Date; var result = _classMasterRepository.InsertEntity(classMasterVm); return(Json(result)); } else { classMasterVm.Id = Convert.ToInt32(TempData["id"]); classMasterVm.IsActive = 1; classMasterVm.CreatedBy = 1; var result = _classMasterRepository.UpdateEntity(classMasterVm); return(Json(result)); } }