Пример #1
0
        //Add species
        public void AddSpecies(CreateExportSpecie input)
        {
            try
            {
                var exportSpecie = new ExportSpecie
                {
                    ExportDetailId = input.ExportDetailId,
                    SpecieId       = input.SpecieId,
                    Quantity       = input.Quantity,
                    Size           = input.Size,
                    Price          = input.Price
                };

                _exportSpecieRepository.Insert(exportSpecie);
            }
            catch (Exception ex)
            {
                throw new UserFriendlyException(ex.Message);
            }
        }
Пример #2
0
        public ActionResult addSpecie(CreateExportSpecie input)
        {
            try
            {
                // TODO: Add  logic

                if (ModelState.IsValid)
                {
                    _exportService.AddSpecies(input);

                    ViewBag.ExportDetail = _exportService.getExportDetailById(input.ExportDetailId);
                    ViewBag.SpecieId     = _specieAppService.GetSpecies().Select(c => new SelectListItem {
                        Value = c.Id.ToString(), Text = c.EnglishName
                    });

                    ModelState.AddModelError("Success", "Specie Added successfully!");
                    return(View());
                }
                else
                {
                    ViewBag.ExportDetail = _exportService.getExportDetailById(input.ExportDetailId);
                    ViewBag.SpecieId     = _specieAppService.GetSpecies().Select(c => new SelectListItem {
                        Value = c.Id.ToString(), Text = c.EnglishName
                    });
                    return(View(input));
                }
            }
            catch
            {
                ViewBag.ExportDetail = _exportService.getExportDetailById(input.ExportDetailId);
                ViewBag.SpecieId     = _specieAppService.GetSpecies().Select(c => new SelectListItem {
                    Value = c.Id.ToString(), Text = c.EnglishName
                });
                return(View(input));
            }
        }