public void UpdateDepartment(Departments department)
 {
     using (SqlConnection cn = new SqlConnection(Settings.ConnectionString))
     {
         var p = new DynamicParameters();
         p.Add("dptName", department.DepartmentName);
         p.Add("dptId", department.DepartmentID);
         cn.Query("UpdateDepartment", p, commandType: CommandType.StoredProcedure);
     }
 }
Example #2
0
        // POST api/<controller>

        public HttpResponseMessage Post(Departments department)
        {

            var ops = new DepartmentOperations();
            ops.CreateDepartment(department.DepartmentName);
            var opsResponse = ops.GetDptIdByName(department.DepartmentName);
            int dptId = opsResponse.Data;

            var response = Request.CreateResponse(HttpStatusCode.Created, department.DepartmentName);

            string uri = Url.Link("DefaultApi", new { id = dptId });
            response.Headers.Location = new Uri(uri);

            return response;


        }
 public void UpdateDepartment(Departments department)
 {
     var repo = new DepartmentRepository();
     repo.UpdateDepartment(department);
 }
Example #4
0
 // PUT api/<controller>/5
 public void Put(Departments department)
 {
     var ops = new DepartmentOperations();
     ops.UpdateDepartment(department);
 }