Exemple #1
0
        public async Task <ActionResult> Create(CompanyGeneralViewModel model)
        {
            try {
                if (ModelState.IsValid)
                {
                    var item = await _companyBusinessManager.CreateCompany(_mapper.Map <CompanyGeneralDto>(model));

                    if (item == null)
                    {
                        return(BadRequest());
                    }

                    return(RedirectToAction(nameof(Edit), new { Id = item.Id }));
                }
            } catch (Exception er) {
                BadRequest(er);
            }

            return(View(model));
        }
Exemple #2
0
        public async Task <ActionResult> Edit(long id, CompanyGeneralViewModel model)
        {
            try {
                if (ModelState.IsValid)
                {
                    var item = await _companyBusinessManager.UpdateCompany(id, _mapper.Map <CompanyGeneralDto>(model));

                    if (item == null)
                    {
                        return(NotFound());
                    }

                    await ClientNotify($"Company Id: {item.Id}: This record was modified by {item.UpdatedBy} on {item.UpdatedDate.ToString()}");
                }
            } catch (Exception er) {
                _logger.LogError(er, er.Message);
                BadRequest(er);
            }
            return(RedirectToAction(nameof(Edit), new { Id = id }));
        }
Exemple #3
0
        public ActionResult Create()
        {
            var model = new CompanyGeneralViewModel();

            return(View(model));
        }