public void CreateAccount(SaveAccountDto saveAccountDto) { var account = _mapper.Map <SaveAccountDto, Account>(saveAccountDto); _unitOfWork.Account.Add(account); _unitOfWork.Complete(); }
public void UpdateAccount(SaveAccountDto saveAccountDto) { var account = _unitOfWork.Account.GetBy(saveAccountDto.Username); if (account == null) { return; } _mapper.Map <SaveAccountDto, Account>(saveAccountDto, account); _unitOfWork.Complete(); }
public void UpdateAccount(SaveAccountDto saveAccountDto) { var product = _unitOfWork.Accounts.GetBy(saveAccountDto.id); if (product == null) { return; } _mapper.Map <SaveAccountDto, Account>(saveAccountDto, product); _unitOfWork.Complete(); }
public void CreateAccount(SaveAccountDto saveAccountDto) { var product = _mapper.Map <SaveAccountDto, Account>(saveAccountDto); var t = GetByUserName(saveAccountDto.username); if (t != null) { return; } _unitOfWork.Accounts.Add(product); _unitOfWork.Complete(); }
public IActionResult OnGet(int?id) { var t = Request.Cookies["logon"]; if (t == null) { return(RedirectToPage("Login")); } if (t == "false") { return(RedirectToPage("Login")); } var permiss = Request.Cookies["permission"]; if (permiss != null) { if (!string.IsNullOrEmpty(permiss)) { if (permiss != "0") { return(RedirectToPage("../Index")); } } } if (id == null) { return(NotFound()); } var pAccount = _service.GetAccount(id ?? default(int)); if (pAccount == null) { return(NotFound()); } Account = _mapper.Map <AccountDto, SaveAccountDto>(pAccount); return(Page()); }
// public SelectList Quyen { get; set; } // public SelectList Active { get; set; } public IActionResult OnGet(string username) { if (username == null) { return(NotFound()); } var account = _context.GetAccount(username ?? default(string)); if (account == null) { return(NotFound()); } // var _quyen = from m in _context.Accounts // select m.UserRole; // Quyen = new SelectList(_quyen.Distinct().ToList()); // var _active = from m in _context.Accounts // select m.Status; // Active = new SelectList(_active.Distinct().ToList()); Account = _mapper.Map <AccountDto, SaveAccountDto>(account); return(Page()); }