コード例 #1
0
        public async Task EditUser(EditUserBindingModel model)
        {
            var editUser = await FindUser(model.Id);

            if (editUser == null)
            {
                throw new NullReferenceException();
            }
            editUser.UserName  = model.Username;
            editUser.CompanyId = model.CompanyId;
            editUser.IsDelete  = model.IsDeleted;
            editUser.IsGlobal  = model.IsGlobal;

            dbContext.Update(editUser);
            await dbContext.SaveChangesAsync();
        }
コード例 #2
0
        public async Task DeleteTicket(DeleteTicketViewModel model)
        {
            var ticketToDelete = await FindTicket(model.Id);

            if (ticketToDelete == null)
            {
                throw new NullReferenceException($"No ticket with id:{model.Id} exists.");
            }
            ticketToDelete.IsDeleted = true;

            dbContext.Update(ticketToDelete);
            await dbContext.SaveChangesAsync();
        }
コード例 #3
0
        public async Task EditCompany(EditCompanyBindingModel model)
        {
            var editedCompany = await FindCompany(model.Id);

            if (editedCompany == null)
            {
                throw new NullReferenceException($"No company with id:{model.Id} exists.");
            }
            else
            {
                editedCompany.Name      = model.Name;
                editedCompany.IsDeleted = model.IsDeleted;
            }
            dbContext.Update(editedCompany);
            await dbContext.SaveChangesAsync();
        }