예제 #1
0
        public ActionResult AddCompayInfo(AddCompanyInfoRequestDTO dto)
        {
            string url = "api/Company/AddCompayInfo";
            enErrorCode result = _apiAdaptor.Post<AddCompanyInfoRequestDTO, enErrorCode>(url, dto);

            return RedirectToAction("BackEndIndex", "Company");
        }
예제 #2
0
        public enErrorCode AddCompayInfo(AddCompanyInfoRequestDTO dto)
        {
            enErrorCode enCode = enErrorCode.EXCEPTION;
            try
            {

                Company c = new Company()
                {
                    CompanyName = dto.CompanyName,
                    Manager = dto.Manager,
                    Sales = dto.Sales,
                    AboutUs = dto.AboutUs,
                    Address = dto.Address,
                    Phone = dto.Phone,
                    Tax = dto.Tax,
                    EMail = dto.EMail,
                    MainProducts = dto.MainProducts,
                    SiteURL = dto.SiteURL,
                    IsEnable = true
                };

                var dbSet = _dbContext.Set<Company>().Add(c);
                int result = _dbContext.SaveChanges();

                if (result == 1)
                {
                    enCode = enErrorCode.SUCCESS;
                }
            }
            catch (Exception ex)
            {

                throw;
            }
            return enCode;
        }