public HttpResponseMessage SaveStaffAllocation(saveStaffAllocationDTO obj)
        {
            HttpResponseMessage message;

            try
            {
                StaffAllocationDAL dal = new StaffAllocationDAL();
                var dynobj             = new { result = dal.SaveStaffAllocation(obj) };
                message = Request.CreateResponse(HttpStatusCode.OK, dynobj);
            }
            catch (Exception ex)
            {
                message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "something Wrong.Try Again!" });
            }
            return(message);
        }
Beispiel #2
0
        public bool SaveStaffAllocation(saveStaffAllocationDTO obj)
        {
            bool res = false;

            obj.CreatedBy = "1001";
            SqlCommand cmd = new SqlCommand("sp_SaveStaffAllocation");

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@p_ClassId", obj.ClassId);
            cmd.Parameters.AddWithValue("@p_DepartmentId", obj.DepartmentId);
            cmd.Parameters.AddWithValue("@p_EmployeeId", obj.EmployeeId);
            cmd.Parameters.AddWithValue("@p_ActionBy", obj.CreatedBy);
            int result = new DBlayer().ExecuteNonQuery(cmd);

            if (result != Int32.MaxValue)
            {
                res = true;
            }
            return(res);
        }