Esempio n. 1
0
        public void UpdateCarcassRevenue(CarcassRevenueViewModel model, int marketingYearId)
        {
            var dto = new CarcassRevenueDto
            {
                Id            = model.Id,
                HuntedGameId  = model.HuntedGameId,
                CarcassWeight = model.CarcassWeight,
                Revenue       = model.Revenue
            };

            _carcassRevenueDao.Update(dto);
        }
Esempio n. 2
0
        public JsonResult Edit(CarcassRevenueViewModel model, int marketingYearId)
        {
            string message = String.Empty;

            try
            {
                _carcassRevenueService.UpdateCarcassRevenue(model, marketingYearId);
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            return(Json(new { message }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
        public void AddCarcassRevenue(CarcassRevenueViewModel model, int marketingYearId)
        {
            IList <CarcassRevenueDto> existingCarcassRevenueDtos = _carcassRevenueDao.GetByMarketingYear(marketingYearId);

            if (existingCarcassRevenueDtos.Any(x => x.HuntedGameId == model.HuntedGameId))
            {
                throw new Exception("Podana zwierzyna została już wcześniej użyta do rozliczenia przychodu. Proszę wybrać inną zwierzynę lub edytować istniejący przychód.");
            }

            var dto = new CarcassRevenueDto
            {
                HuntedGameId  = model.HuntedGameId,
                CarcassWeight = model.CarcassWeight,
                Revenue       = model.Revenue
            };

            _carcassRevenueDao.Insert(dto);
        }