public DataResponse <EntityPracticeType> UpdatePracticeSpeciality(EntityPracticeType entity) { var response = new DataResponse <EntityPracticeType>(); try { base.DBInit(); var model = DBEntity.LookupPracticeTypes.FirstOrDefault(a => a.Id == entity.Id); model.PracticeType = entity.PracticeType; model.IsActive = entity.IsActive; model.UpdatedOn = entity.UpdatedOn; model.UpdatedBy = entity.UpdatedBy; if (base.DBSaveUpdate(model) > 0) { return(GetPracticeTypeById(model.Id)); } else { response.CreateResponse(DataResponseStatus.InternalServerError); } } catch (Exception ex) { ex.Log(); } finally { base.DBClose(); } return(response); }
public IHttpActionResult CreatePracticeType(PracticeTypeModel model) { var response = new DataResponse <EntityPracticeType>(); if (ModelState.IsValid) { var entityPracticeType = new EntityPracticeType(); entityPracticeType.PracticeType = model.PracticeType; entityPracticeType.IsActive = model.IsActive; entityPracticeType.CreatedBy = CurrentUserId; response = repository.Insert(entityPracticeType); } return(Ok <DataResponse>(response)); }
public IHttpActionResult UpdatePracticeType(PracticeTypeModel model) { var response = new DataResponse <EntityPracticeType>(); if (ModelState.IsValid) { var entityPracticeType = new EntityPracticeType(); entityPracticeType.Id = model.Id; entityPracticeType.PracticeType = model.PracticeType; entityPracticeType.IsActive = model.IsActive; entityPracticeType.UpdatedBy = CurrentUserId; entityPracticeType.UpdatedOn = System.DateTime.UtcNow; response = repository.UpdatePracticeSpeciality(entityPracticeType); } return(Ok <DataResponse>(response)); }
public DataResponse <EntityPracticeType> Insert(EntityPracticeType entity) { var response = new DataResponse <EntityPracticeType>(); try { base.DBInit(); var model = new Database.LookupPracticeType { PracticeType = entity.PracticeType, CreatedBy = entity.CreatedBy, CreatedOn = System.DateTime.UtcNow, IsActive = entity.IsActive }; if (base.DBSave(model) > 0) { entity.Id = model.Id; response.CreateResponse(entity, DataResponseStatus.OK); } else { response.CreateResponse(DataResponseStatus.InternalServerError); } } catch (Exception ex) { ex.Log(); } finally { base.DBClose(); } return(response); }