public HttpResponseMessage PutCropStep_VideoAllocation(int id, CropStep_VideoAllocation cropStep_VideoAllocation) { if (!ModelState.IsValid) { return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.BadRequest, new { data = new { string.Empty }, success = false, error = string.Empty })); } if (id != cropStep_VideoAllocation.Id) { return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.BadRequest, new { data = new { string.Empty }, success = false, error = string.Empty })); } db.Entry(cropStep_VideoAllocation).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CropStep_VideoAllocationExists(id)) { return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.NotFound, new { data = new { string.Empty }, success = false, error = string.Empty })); } else { throw; } } return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.OK, new { data = new { cropStep_VideoAllocation }, success = true, error = string.Empty })); }
public IHttpActionResult DeleteCropStep_VideoAllocation(int id) { CropStep_VideoAllocation cropStep_VideoAllocation = db.CropStep_VideoAllocation.Find(id); if (cropStep_VideoAllocation == null) { return(NotFound()); } db.CropStep_VideoAllocation.Remove(cropStep_VideoAllocation); db.SaveChanges(); return(Ok(cropStep_VideoAllocation)); }
public HttpResponseMessage PostCropStep_VideoAllocation(CropStep_VideoAllocation cropStep_VideoAllocation) { if (!ModelState.IsValid) { return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.BadRequest, new { data = new { string.Empty }, success = false, error = string.Empty })); } int recordCount = db.CropStep_VideoAllocation.Where(a => a.StepId == cropStep_VideoAllocation.StepId && a.LangId == cropStep_VideoAllocation.LangId && a.Active == true).Count(); if (recordCount > 0) { return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.OK, new { data = new { string.Empty }, success = false, error = "Video already allocated with this Crop." })); } db.CropStep_VideoAllocation.Add(cropStep_VideoAllocation); db.SaveChanges(); return((HttpResponseMessage)Request.CreateResponse(HttpStatusCode.OK, new { data = new { id = cropStep_VideoAllocation.Id }, success = true, error = string.Empty })); }