예제 #1
0
 public void Create(CompaniesVM company)
 {
     _context.Company.Add(new Company
     {
         Name    = company.Name,
         Country = company.Country,
         City    = company.City,
         Street  = company.Street,
         ZipCode = company.ZipCode
     });
     _context.SaveChangesAsync();
 }
예제 #2
0
        public void Update(CompaniesVM company)
        {
            var data = _context.Company.FirstOrDefault(x => x.Id == company.Id);

            if (data != null)
            {
                data.Name    = company.Name;
                data.Country = company.Country;
                data.City    = company.City;
                data.Street  = company.Street;
                data.ZipCode = company.ZipCode;
            }
            _context.SaveChangesAsync();
        }