Beispiel #1
0
        public async Task UpdateDiscount(DiscountViewModel viewModel)
        {
            var discount = _mapper.Map <Discount>(viewModel);

            _context.Update(discount);
            await _context.SaveChangesAsync();
        }
Beispiel #2
0
        public async Task UpdateDepartment(DepartmentViewModel viewModel)
        {
            var department = _mapper.Map <Department>(viewModel);

            _context.Update(department);
            await _context.SaveChangesAsync();
        }
Beispiel #3
0
        public async Task UpdateOfferItem(OfferItemViewModel viewModel)
        {
            var offerItem = _mapper.Map <OfferItem>(viewModel);

            _context.Update(offerItem);
            await _context.SaveChangesAsync();
        }
Beispiel #4
0
        public async Task UpdateOrder(OrderViewModel viewModel)
        {
            var order = _mapper.Map <Order>(viewModel);

            _context.Update(order);
            await _context.SaveChangesAsync();
        }
Beispiel #5
0
        public async Task UpdatePosition(PositionViewModel viewModel)
        {
            var position = _mapper.Map <Position>(viewModel);

            _context.Update(position);
            await _context.SaveChangesAsync();
        }
Beispiel #6
0
        public async Task UpdateCandidate(CandidateViewModel viewModel, int id)
        {
            var candidate = _mapper.Map <Candidate>(viewModel);

            _context.Update(candidate);

            var address = await _context.Addresses.FirstAsync(a => a.CandidateId == id);

            address.Location      = viewModel.Address.Location;
            address.AddressNumber = viewModel.Address.AddressNumber;
            address.Country       = viewModel.Address.Country;
            address.Comments      = viewModel.Address.Comments;
            address.PostCode      = viewModel.Address.PostCode;
            _context.Addresses.Update(address);

            var phone = await _context.Phones.FirstAsync(p => p.CandidateId == id);

            phone.Number    = viewModel.Phone.Number;
            phone.PhoneType = viewModel.Phone.PhoneType;
            _context.Phones.Update(phone);

            var email = await _context.Emails.FirstAsync(e => e.CandidateId == id);

            email.Mail     = viewModel.Email.Mail;
            email.MailType = viewModel.Email.MailType;
            _context.Emails.Update(email);
            await _context.SaveChangesAsync();
        }
Beispiel #7
0
        public async Task UpdateInterview(InterviewViewModel viewModel)
        {
            var interview = _mapper.Map <Interview>(viewModel);

            _context.Update(interview);
            await _context.SaveChangesAsync();
        }
Beispiel #8
0
        public async Task UpdatePurchase(PurchaseViewModel viewModel)
        {
            var purchase = _mapper.Map <Purchase>(viewModel);

            _context.Update(purchase);
            await _context.SaveChangesAsync();
        }
Beispiel #9
0
        public async Task UpdateSector(int id, SectorViewModel viewModel)
        {
            var sector = _mapper.Map <Sector>(viewModel);

            _context.Sectors.Update(sector);
            _context.Update(sector);
            await _context.SaveChangesAsync();
        }
Beispiel #10
0
        public async Task UpdateEmployee(EmployeeViewModel viewModel, int id)
        {
            var employee = _mapper.Map <Employee>(viewModel);

            _context.Update(employee);

            var address = await _context.Addresses.FirstOrDefaultAsync(a => a.EmployeeId == id);

            address.Location      = viewModel.Location;
            address.AddressNumber = (Int16)viewModel.AddressNumber;
            address.Country       = viewModel.Country;
            address.Comments      = viewModel.Comments;
            address.PostCode      = (Int16)viewModel.PostCode;
            _context.Addresses.Update(address);

            var phone = await _context.Phones.FirstOrDefaultAsync(p => p.EmployeeId == id);

            if (phone == null)
            {
                var newPhone = new Phone()
                {
                    EmployeeId = id,
                    Number     = viewModel.PhoneNumber,
                    PhoneType  = viewModel.PhoneType
                };
                _context.Phones.Add(newPhone);
            }
            else
            {
                phone.Number    = viewModel.PhoneNumber;
                phone.PhoneType = viewModel.PhoneType;
                _context.Phones.Update(phone);
            }

            var email = await _context.Emails.FirstOrDefaultAsync(e => e.EmployeeId == id);

            if (email == null)
            {
                var newMail = new Email()
                {
                    EmployeeId = id,
                    Mail       = viewModel.Email,
                    MailType   = viewModel.MailType
                };
                _context.Emails.Add(newMail);
            }
            else
            {
                email.Mail     = viewModel.Email;
                email.MailType = viewModel.MailType;
                _context.Emails.Update(email);
            }

            await _context.SaveChangesAsync();
        }
Beispiel #11
0
        public async Task UpdateSupplier(SupplierViewModel viewModel)
        {
            var supplier = _mapper.Map <Supplier>(viewModel);

            _context.Update(supplier);
            await _context.SaveChangesAsync();

            await UpdateSupplierEmail(viewModel, supplier.Id);
            await UpdateSupplierPhone(viewModel, supplier.Id);
            await UpdateSupplierAddress(viewModel, supplier.Id);

            await _context.SaveChangesAsync();
        }
Beispiel #12
0
 public async Task UpdateLeave(Leave leave)
 {
     _context.Update(leave);
     await _context.SaveChangesAsync();
 }