public HttpResponseMessage SaveSection(SaveSectionDTO obj) { HttpResponseMessage message; try { SectionDAL dal = new SectionDAL(); var dynobj = new { result = dal.SaveSection(obj) }; message = Request.CreateResponse(HttpStatusCode.OK, dynobj); } catch (Exception ex) { message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "something Wrong.Try Again!" }); } return(message); }
public bool SaveSection(SaveSectionDTO obj) { bool res = false; obj.CreatedBy = "1001"; SqlCommand cmd = new SqlCommand("sp_SaveSection"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@p_DepartmentId", obj.DepartmentId); cmd.Parameters.AddWithValue("@p_Code", obj.Code); cmd.Parameters.AddWithValue("@p_ClassId", obj.ClassId); cmd.Parameters.AddWithValue("@p_Section", obj.Section); cmd.Parameters.AddWithValue("@p_ActionBy", obj.CreatedBy); int result = new DBlayer().ExecuteNonQuery(cmd); if (result != Int32.MaxValue) { res = true; } return(res); }