예제 #1
0
        public Admin Update(int adminId, InsertAdminRequest request)
        {
            var admin = _context.Admins.Find(adminId);

            _mapper.Map(request, admin);
            _context.SaveChanges();

            _accoutnService.Update(admin.AccountId, request);


            return(_mapper.Map <Model.Admin>(admin));
        }
예제 #2
0
        public Admin Insert(InsertAdminRequest request)
        {
            var admin = _mapper.Map <Database.Admins>(request);

            request.Role = Role.Admin;
            var accountId = _accoutnService.Insert(request).AccountId;

            admin.AccountId = accountId;

            _context.Admins.Add(admin);
            _context.SaveChanges();

            return(_mapper.Map <Model.Admin>(admin));
        }