public IHttpActionResult AddComplaint(ComplaintBindingModel model) { try { ComplaintBindingModel complaintBindingModel = new ComplaintBindingModel(); ComplaintModel complaintModel = new ComplaintModel(); AutoMapper.Mapper.Map(model,complaintModel); complaintModel = complaintService.InsertComplaint(complaintModel); AutoMapper.Mapper.Map(complaintModel, complaintBindingModel); return Ok(complaintBindingModel); } catch (Exception ex) { return BadRequest(ex.Message); } }
public IHttpActionResult UpdateComplaint(int complaintId) { try { ComplaintBindingModel complaintBindingModel = new ComplaintBindingModel(); ComplaintModel complaintModel = new ComplaintModel(); complaintModel = complaintService.GetComplaintByComplaintId(complaintId); complaintModel.Status = ComplaintStatus.Close; complaintModel = complaintService.UpdateComplaint(complaintModel); AutoMapper.Mapper.Map(complaintModel, complaintBindingModel); return Ok(complaintBindingModel); } catch(Exception ex) { return BadRequest(ex.Message); } }
public IHttpActionResult GetComplaintByComplaintId(int complaintId) { ComplaintBindingModel complaintBindingModel = new ComplaintBindingModel(); ComplaintModel complaintModel = new ComplaintModel(); // AutoMapper.Mapper.Map(jobBindingModel, jobModel); complaintModel = complaintService.GetComplaintDetailByComplaintId(complaintId); AutoMapper.Mapper.Map(complaintModel, complaintBindingModel); return Ok(complaintBindingModel); }