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);
 }
      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();
      }
 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);
   }
 }