public ZonalViewModel() { var Scope = Startup.Instance.provider.CreateScope(); _marketingZone = new MarketingZone(); _repositoryZonal = Scope.ServiceProvider.GetRequiredService <IZonalService>(); marketingZones = _repositoryZonal.GetAllActive(); WireCommands(); }
public void Delete(MarketingZone marketingZone) { string json = JsonConvert.SerializeObject(marketingZone, Formatting.Indented); var buffer = System.Text.Encoding.UTF8.GetBytes(json); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var stringContent = new StringContent(JsonConvert.SerializeObject(marketingZone), Encoding.UTF8, "application/json"); var httpResponce = _httpClient.PostAsync("api/Zonal/Delete", byteContent); }
public IActionResult Delete([FromBody] MarketingZone marketingZone) { if (marketingZone == null) { return(BadRequest()); } _zonalService.Delete(marketingZone); return(Ok()); }
public IActionResult ZonalPost([FromBody] MarketingZone referrer) { if (referrer == null) { return(BadRequest()); } var identifier = _zonalService.Insert(referrer); return(Ok()); }
public string Insert(MarketingZone marketingZone) { _unitOfWork.GetRepository <MarketingZone>().Add(marketingZone); try { _unitOfWork.SaveChanges(); } catch (Exception ex) { string msg = ex.Message; } return(marketingZone.Identifier); }
public string Insert(MarketingZone marketingZone) { string json = JsonConvert.SerializeObject(marketingZone, Formatting.Indented); var buffer = System.Text.Encoding.UTF8.GetBytes(json); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var stringContent = new StringContent(JsonConvert.SerializeObject(marketingZone), Encoding.UTF8, "application/json"); var httpResponce = _httpClient.PostAsync("Zonal", byteContent); Console.WriteLine(httpResponce); return(null); }
public void Delete(MarketingZone marketingZone) { try { _unitOfWork.GetRepository <MarketingZone>().Delete(marketingZone.Id); _unitOfWork.SaveChanges(); } catch (Exception ex) { string msg = ex.Message; } }
public void DeleteZonal() { MarketingZone m = CurrentMarketingZone; _repositoryZonal.Delete(m); }