public HttpResponseMessage CreateSiteAllocation(AddSiteAllocationDTO service) { HttpResponseMessage message; try { // SiteMappingDataAccessLayer dal = new SiteMappingDataAccessLayer(); var dynObj = new { result = _Site.InsertSiteAllocation(service) }; message = Request.CreateResponse(HttpStatusCode.OK, dynObj); } catch (Exception ex) { message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Something wrong. Try Again!" }); ErrorLog.CreateErrorMessage(ex, "SiteMapping", "CreateSiteAllocation"); } return(message); }
public bool InsertSiteAllocation(AddSiteAllocationDTO objSite) { bool res = false; SqlCommand SqlCmd = new SqlCommand("spInsertManpowerSiteAllocation"); SqlCmd.CommandType = CommandType.StoredProcedure; SqlCmd.Parameters.AddWithValue("@CustomerId", objSite.CustomerId); SqlCmd.Parameters.AddWithValue("@BranchId", objSite.BranchId); SqlCmd.Parameters.AddWithValue("@SiteId", objSite.SiteId); SqlCmd.Parameters.AddWithValue("@ClassificationId", objSite.ClassificationId); SqlCmd.Parameters.AddWithValue("@Service", objSite.Service); SqlCmd.Parameters.AddWithValue("@NoofManpower", objSite.NoofManpower); SqlCmd.Parameters.AddWithValue("@CreatedBy", objSite.CreatedBy); int result = new DbLayer().ExecuteNonQuery(SqlCmd); if (result != Int32.MaxValue) { res = true; } return(res); }