Ejemplo n.º 1
0
        public async Task <IActionResult> Post([FromBody] CountryForm model)
        {
            if (ModelState.IsValid)
            {
                var country = new Country(model.Id)
                {
                    Name              = model.Name,
                    Code3             = model.Code3,
                    IsBillingEnabled  = model.IsBillingEnabled,
                    IsShippingEnabled = model.IsShippingEnabled,
                    IsCityEnabled     = model.IsCityEnabled,
                    IsZipCodeEnabled  = model.IsZipCodeEnabled,
                    IsDistrictEnabled = model.IsDistrictEnabled
                };

                _countryRepository.Add(country);
                await _countryRepository.SaveChangesAsync();

                return(CreatedAtAction(nameof(Get), new { id = country.Id }, null));
            }
            return(BadRequest(ModelState));
        }
Ejemplo n.º 2
0
 public virtual Task InsertUserNotificationAsync(UserNotification userNotification)
 {
     _userNotificationRepository.Add(userNotification);
     return(Task.CompletedTask);
 }