public HttpResponseMessage Delete(Employee emp)
        {
            DAL.DAL dal         = new DAL.DAL();
            int     empInserted = dal.DeleteEmployee(emp);

            if (empInserted > 1)
            {
                return(new HttpResponseMessage(HttpStatusCode.Created));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, new Exception("Invalid Employee details")));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// DELETE Operation
 /// </summary>
 /// <param name="context"></param>
 private void DELETE(HttpContext context)
 {
     try
     {
         int EmpCode = Convert.ToInt16(context.Request["id"]);
         dal.DeleteEmployee(EmpCode);
         WriteResponse("Employee Deleted Successfully");
     }
     catch (Exception ex)
     {
         WriteResponse("Error in CREATE");
         errHandler.ErrorMessage = dal.GetException();
         errHandler.ErrorMessage = ex.Message.ToString();
     }
 }