コード例 #1
0
 public ActionResult Edit(Guid? id)
 {
   var TypeMember = new TypeMemberModel();
   if (id != null)
     TypeMember = Mapper.Map<TypeMemberDTO, TypeMemberModel>(_typeMemberReportService.GetById((Guid)id));
   return View("Edit", TypeMember);
 }
コード例 #2
0
      public ActionResult Edit(TypeMemberModel model)
      {
        if (!ModelState.IsValid)
        {
          return ModelState.JsonValidation();
        }

        try
        {
          Save(model);
          return ModelState.JsonValidation(new { Success = true, model.TypeMemberId });
        }
        catch (Exception ex)
        {
          ModelState.AddModelError("Edit_typeMember", ex.Message);
        }
        return ModelState.JsonValidation();
      }
コード例 #3
0
 private void Save(TypeMemberModel model)
 {
   if (model.TypeMemberId == Guid.Empty)
   {
     var createCommand = new AddTypeMemberCommand(model.Name,model.ScoresFrom,model.ScoresTo,model.PercentDownPayment);
     model.TypeMemberId = _typeMemberCommandService.AddTypeMember(createCommand);
   }
   else
   {
     var updateCommand = new EditTypeMemberCommand(model.TypeMemberId, model.Name, model.ScoresFrom, model.ScoresTo, model.PercentDownPayment);
     _typeMemberCommandService.EditTypeMember(updateCommand);
   }
 }