Exemple #1
0
        public async Task <IActionResult> DeleteCompany(int id)
        {
            try
            {
                await _repo.DeleteCompany(id);

                return(Ok("Company was Deleted"));
            }
            catch (Exception e)
            {
                return(Ok(e.Message));
            }
        }
Exemple #2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            try
            {
                Company companyDM = await _companyServices.FindCompany(id);

                await _companyServices.DeleteCompany(companyDM);

                TempData["msgSuccess"] = "Company Deleted";
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("NotFound", "Error"));
            }
        }
        public async Task <JsonResult> DeleteCompany([FromBody] CompanyEntity company)
        {
            try
            {
                string userUniqueName = HttpContext.User.Identity.Name;
                await companyServices.DeleteCompany(company, userUniqueName);

                var result = 0;
                return(Json(result));
            }
            catch (Exception ex)
            {
                await errorServices.ErrorNotification(ex, HttpContext.User.Identity.Name, "", "");

                return(Json(ex));
            }
        }
        public HttpResponseMessage Delete(int id)
        {
            HttpResponseMessage msg = Request.CreateResponse(HttpStatusCode.BadRequest, false);

            try
            {
                if (id > 0)
                {
                    var isSuccess = _companyServices.DeleteCompany(id);
                    if (isSuccess)
                    {
                        msg = Request.CreateResponse(HttpStatusCode.OK, isSuccess);
                    }
                }

                return(msg);
            }
            catch (Exception ex)
            {
                return(msg);
            }
        }
 public void Delete(Guid id)
 {
     _services.DeleteCompany(id);
 }