Ejemplo n.º 1
0
        public HttpResponseMessage DeleteCompanyIndustryClassificationView(CompanyIndustryClassificationViewModel model)
        {
            HttpResponseMessage result;
            List <CompanyIndustryClassificationViewModel> datalist;

            try
            {
                if (this.ModelState.IsValid == true)
                {
                    datalist = service.DeleteCompanyIndustryClassificationView(model);
                    if (datalist != null)
                    {
                        result = Request.CreateResponse(HttpStatusCode.OK, datalist);
                    }
                    else
                    {
                        string message = "Error while deleting CompanyIndustryClassificationView data";
                        result = Request.CreateResponse(HttpStatusCode.Forbidden, message);
                    }
                }
                else
                {
                    result = Request.CreateResponse(HttpStatusCode.BadRequest, this.ModelState);
                }
            }
            catch (Exception ex)
            {
                result = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message);
            }
            return(result);
        }
Ejemplo n.º 2
0
        public List <CompanyIndustryClassificationViewModel> DeleteCompanyIndustryClassificationView(CompanyIndustryClassificationViewModel dataModel)
        {
            try
            {
                companyRepository.DeleteCompanyIndustryClassification(dataModel.ID);
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(dataModel.CurrentUserID, "AgentBusiness", message);
                throw new Exception(ex.Message);
            }

            BaseViewModel md = new BaseViewModel();

            md.CurrentCulture = dataModel.CurrentCulture;
            md.CurrentUserID  = dataModel.CurrentUserID;
            return(GetCompanyIndustryClassificationViewList(md));
        }
Ejemplo n.º 3
0
        public List <CompanyIndustryClassificationViewModel> SaveCompanyIndustryClassificationView(CompanyIndustryClassificationViewModel dataModel)
        {
            CompanyIndustryClassification data;

            try
            {
                Utility.SetDynamicPropertyValue(dataModel, dataModel.CurrentCulture);
                data = Mapper.Map <CompanyIndustryClassificationViewModel, CompanyIndustryClassification>(dataModel);

                if (dataModel.ID == Guid.Empty)
                {
                    data.ID          = Guid.NewGuid();
                    data.CreatedBy   = dataModel.CurrentUserID;
                    data.CreatedDate = DateTime.Now;
                    companyRepository.InsertCompanyIndustryClassification(data);
                }
                else
                {
                    data.UpdatedBy   = dataModel.CurrentUserID;
                    data.UpdatedDate = DateTime.Now;
                    companyRepository.UpdateCompanyIndustryClassification(data);
                }
            }
            catch (Exception ex)
            {
                IErrorLogService errorLog = new ErrorLogService();
                string           message  = ex.InnerException != null ? ex.InnerException.InnerException.Message : ex.Message;
                errorLog.SetErrorLog(dataModel.CurrentUserID, "AgentBusiness", message);
                throw new Exception(ex.Message);
            }

            BaseViewModel md = new BaseViewModel();

            md.CurrentCulture = dataModel.CurrentCulture;
            md.CurrentUserID  = dataModel.CurrentUserID;
            return(GetCompanyIndustryClassificationViewList(md));
        }