예제 #1
0
        public EstimateStatus MapEstimateStatusDTO(EstimateStatusDTO input)
        {
            EstimateStatus output = new EstimateStatus();

            output.Description = input.Description;
            output.EstimateStatusId = input.EstimateStatusId;

            return output;
        }
예제 #2
0
        public ActionResult EstimateStatusPost(EstimateStatusDTO estimateStatusDTO)
        {
            if (!ModelState.IsValid)
                throw new HttpException(400, "Invalid data.");

            EstimateStatus estimateStatus = _mapper.MapEstimateStatusDTO(estimateStatusDTO);

            if (!_estimateStatusService.Exists(estimateStatusDTO.EstimateStatusId))
                _estimateStatusService.Insert(estimateStatus);
            else
                _estimateStatusService.Update(estimateStatus);

            return RedirectToAction("EstimateStatuses");
        }