Exemple #1
0
 public ActionResult Create(Model.Claim model)
 {
     if (ModelState.IsValid)
     {
         _claimService.Insert(model);
         return(RedirectToAction("List"));
     }
     SetDropDownData();
     return(View());
 }
        public IHttpActionResult Post(ClaimDto dto)
        {
            ExecuteInTransaction(session =>
            {
                string user      = (User.Identity as ClaimsIdentity).Claims.Where <Claim>(c => c.Type == ClaimTypes.NameIdentifier).Single().Value;
                ModelClaim claim = dto.Id.HasValue ?
                                   session.Get <ModelClaim>(dto.Id.Value) :
                                   new ModelClaim()
                {
                    Customer = LoadEntity <Model.User>(session, Guid.Parse(user)),
                    Created  = DateTime.Now
                };
                ModelMapper.Map <ClaimDto, ModelClaim>(dto, claim);
                session.SaveOrUpdate(claim);
                dto = ModelMapper.Map <ModelClaim, ClaimDto>(claim, dto);
            });

            return(Ok <ClaimDto>(dto));
        }
Exemple #3
0
        public void Insert(Model.Claim model)
        {
            var user = HttpContext.Current.User.Identity.GetUserInfo();

            model.UserId = user.Id;
            var projectCategoty       = _dicService.GetDictionaryValue("ClaimCategory", "Projector").Id;
            var confirmStatus         = _dicService.GetDictionaryValue("ClaimStatus", "OnConfirm").Id;
            var inconsiderationStatus = _dicService.GetDictionaryValue("ClaimStatus", "Inconsideration").Id;

            if (model.CategoryId == projectCategoty && user.Role != Role.Director)
            {
                model.StatusId = confirmStatus;
            }
            else
            {
                model.StatusId = inconsiderationStatus;
            }
            _repository.InsertOrUpdate(model);
        }