public IActionResult AreaAdd(AreaAdd model)
        {
            var            result         = false;
            var            url            = "https://localhost:44354/api/area/add";
            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);

            httpWebRequest.ContentType = "application/json";
            httpWebRequest.Method      = "POST";
            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                var json = JsonConvert.SerializeObject(model);
                streamWriter.Write(json);
            }
            var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();

            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                var resResult = streamReader.ReadToEnd();
                result = bool.Parse(resResult);
            }
            if (result)
            {
                TempData["ThanhCong"] = "Đã tạo phòng ban thành công";
            }
            // ModelState.Clear();
            return(View(new AreaAdd()
            {
            }));
        }
Exemplo n.º 2
0
 public bool AreaAdd(AreaAdd request)
 {
     try
     {
         DynamicParameters parameters = new DynamicParameters();
         parameters.Add("@Name", request.Name);
         SqlMapper.Execute(con, "Areas_Add", param: parameters, commandType: CommandType.StoredProcedure);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 public bool AreaAdd(AreaAdd request)
 {
     return(_areaResponsitory.AreaAdd(request));
 }
Exemplo n.º 4
0
 public bool AreaAdd([FromBody] AreaAdd request)
 {
     return(_areaService.AreaAdd(request));
 }