/// <summary> /// 執行註冊 /// </summary> /// <param name="parameter"></param> /// <returns></returns> public BaseResultModel <object> DoSignUp(SignUpParameter parameter) { var result = new BaseResultModel <object>() { Result = false }; var rptParameter = _Mapper.Map <MemberAddRptParameter>(parameter); var member = _MemberRepository.Get().FirstOrDefault(x => x.Account == parameter.Email); if (member != null) { result.Message = "信箱已經被註冊"; result.Description = "錯誤"; } else { var rptResult = _MemberRepository.Create(rptParameter); if (rptResult) { result.Message = "註冊成功"; result.Description = "成功"; } else { result.Message = "註冊失敗"; result.Description = "註冊失敗"; } } return(result); }
public async Task <IActionResult> PostMember([FromBody] MemberDto memberDto) { var member = memberDto.ToDbModel(); var created = await _memberRepository.Create(member); return(Created($"/{created.SSN}", created.ToDto())); }
public ActionResult Register(RegisterModel model) { int recordID = 0; if (ModelState.IsValid) { try { recordID = _repository.Create(model); if (recordID > 0) { FormsAuthentication.SetAuthCookie(model.Email, false); //Set UserID Cookie HttpCookie cookie = new HttpCookie("UserID"); if (cookie != null) { cookie.Value = recordID.ToString(); cookie.Expires = DateTime.Now.AddHours(24); ControllerContext.HttpContext.Response.Cookies.Add(cookie); } return(RedirectToAction("Index", "Home")); } } catch (Exception e) { ModelState.AddModelError("", "Error: " + e.ToString()); } } // If we got this far, something failed, redisplay form return(View(model)); }
public async Task <Member> Reqister(ReqisterMemberDto reqisterMemberDto, string roleName) { if (!await _roleServicey.RoleExist(roleName)) { return(null); } Member member = _mapper.Map <Member>(reqisterMemberDto); member.Password = reqisterMemberDto.Password.EncryptWithBCrypt(); member = await _memberRepository.Create(member); //role for member UserRole userRole = new UserRole() { Member = member, Role = await _roleServicey.GetRole(roleName) }; //Adding UserRoleToDatabase UserRoleService ve UserRoleRepository Yazilmalidi. await _userRoleoleService.Create(userRole); reqisterMemberDto.Password = member.Password; return(member); }
public Member CreateMember(Member memb) { if (string.IsNullOrEmpty(memb.FirstName) || string.IsNullOrEmpty(memb.LastName) || string.IsNullOrEmpty(memb.Address)) { throw new InvalidDataException("Missing fields"); } return(_customerRepo.Create(memb)); }
public Member Create(Member model) { if (_memberRepository.GetByEmail(model.Email) != null) { throw new MemberAlreadyExistsException("Member already exists for email: " + model.Email); } return(_memberRepository.Create(model)); }
public bool Create(Member entity) { if (entity != null) { _memberRepository.Create(entity); return true; } return false; }
public ActionResult Create([Bind(Include = "Id,Name,Email,Birth,Married,Memo")] Member member) { if (ModelState.IsValid) { //リポジトリを利用してメンバー情報を登録 _rep.Create(member); return(RedirectToAction("Index")); } return(View(member)); }
public ActionResult Create([Bind(Include = "Id,Name,Email,Birth,Married,Memo")] Member member) { if (ModelState.IsValid) { //db.Members.Add(member); //db.SaveChanges(); _rep.Create(member); return(RedirectToAction("Index")); } return(View(member)); }
public void SaveMember(Member member) { if (member.MemberId == 0) { memberRepository.Create(member); } else { memberRepository.Update(member); } memberRepository.SaveChanges(); }
public async Task <IActionResult> Create([FromBody] CreateMemberParms parms) { try { await _memberRepo.Create(parms); return(this.Ok("Success")); } catch (Exception ex) { Log.LogError(ex, "MemberViewController threw an exception"); return(BadRequest("There was an error creating the member profile")); } }
public ActionResult Create([Bind(Include = "Id,Name,Email,EmailConfirmed,Birth,Married,Memo")] Member member) { if (ModelState.IsValid) { //_db.Members.Add(member); //_db.SaveChanges(); _rep.Create(member); TempData["success"] = $"{member.Name}さんを新規に登録しました。"; return(RedirectToAction("Index")); } return(View(member)); }
public OperationResult Create(CreateMember command) { var operation = new OperationResult(); if (_memberRepository.Exist(x => x.Mobile == command.Mobile)) { return(operation.Failed(ApplicationMessages.DuplicatedRecord)); } var member = new Member(command.FullName, command.Mobile); _memberRepository.Create(member); _memberRepository.SaveChanges(); return(operation.Succedded()); }
public SignUpResult SignUp(string mailAddress, string password) { var m = new MailAddress(mailAddress); var p = new Password(password); var existMember = memberRepository.Find(m) != null; if (existMember) { return(SignUpResult.ExistMember); } memberRepository.Create(m, p); return(SignUpResult.Success); }
public async Task <IActionResult> Create(MemberForCreateDto memberForCreateDto) { var memberToCreate = new Member { Name = memberForCreateDto.Name, Gender = memberForCreateDto.Gender, DateOfBirth = memberForCreateDto.DateOfBirth, Phone = memberForCreateDto.Phone, Address = memberForCreateDto.Address, CreatedDate = memberForCreateDto.CreatedDate }; var createdMember = await _repo.Create(memberToCreate); return(StatusCode(201)); }
public IActionResult Create(CreateMemberViewModel model) { if (ModelState.IsValid) { int?facultyId, groupId; if (model.FacultyId == 0) { facultyId = null; } else { facultyId = model.FacultyId; } if (model.GroupId == 0) { groupId = null; } else { groupId = model.GroupId; } Member member = new Member { Name = model.Name, Surname = model.Surname, Patronymic = model.Patronymic, DateOfEntry = model.DateOfEntry, IsScholarship = model.IsScholarship, FacultyId = facultyId, GroupId = groupId, NumberOfTicket = model.NumberOfTicket }; _membersRepository.Create(member); return(RedirectToAction("index", "home")); } return(RedirectToAction("create")); }
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { MembershipUser membershipUser = GetUser(email, false); if (membershipUser == null) { try { Member member = new Member { MemberName = username, Email = email, Password = Crypto.HashPassword(password) }; member = _memberRepository.Create(member); if (member == null) { status = MembershipCreateStatus.UserRejected; return(null); } membershipUser = GetUser(email, false); if (membershipUser == null) { status = MembershipCreateStatus.UserRejected; return(null); } status = MembershipCreateStatus.Success; return(membershipUser); } catch (Exception exc) { throw new Exception(exc.Message); } } status = MembershipCreateStatus.UserRejected; return(null); }
public ActionResult Create(MemberViewModel model) { try { if (!ModelState.IsValid) { return(View(model)); } var member = _mapper.Map <Member>(model); var isSuccess = _repo.Create(member); if (!isSuccess) { ModelState.AddModelError("", "Something went wrong..."); return(View(model)); } ViewBag.successMessage = "Successfull"; return(View()); } catch { ModelState.AddModelError("", "Something went wrong..."); return(View(model)); } }
public ActionResult <Member> Create([FromBody] Member member) { return(Ok(_memberRepository.Create(member))); }
public IActionResult Create(Member member) { _repository.Create(member); return(RedirectToAction("Index")); }
public virtual Member CreateMember(Member member) { memberRepository.Create(member); return(member); }
public void Create(Member member) { memberRepository.Create(member); }
public int Create(Member member) { return(_memberRepository.Create(Mapper.Map <Member, DataLayer.Models.Member>(member))); }