/// <summary> /// Update CustomerType /// </summary> /// <param name="obj">New CustomerType</param> /// <returns></returns> public ApiResponseViewModel Update(CustomerType obj) { var result = new CustomerTypeViewModel(); var response = new ApiResponseViewModel { Code = CommonConstants.ApiResponseSuccessCode, Message = null, Result = null }; try { var exists = _customerTypeRepository.CheckContains(m => m.ID == obj.ID); if (exists) { _customerTypeRepository.Update(obj); _unitOfWork.Commit(); response.Message = CommonConstants.SaveSuccess; } else { response.Code = CommonConstants.ApiResponseNotFoundCode; response.Message = CommonConstants.NotFoundMessage; } } catch (Exception ex) { response.Code = CommonConstants.ApiResponseExceptionCode; response.Message = CommonConstants.ErrorMessage + " " + ex.Message; } return(response); }