public ActionResult ChangeImageLocation(ImageLocationModel model) { if (!_imageService.ChangeImageLocation(model)) { return(Error("Images does not exist", $"There are no images with workorderID: {model.WorkOrderId}. images == null")); } return(Success()); }
public bool ChangeImageLocation(ImageLocationModel model) { var images = repository.SearchFor <SageImageWorkOrder>(x => x.WorkOrder == model.WorkOrderId).SingleOrDefault(); var changedImage = images?.Images.SingleOrDefault(x => x.Id == model.PictureId && !x.IsDeleted); if (changedImage == null) { return(false); } changedImage.Latitude = model.Latitude; changedImage.Longitude = model.Longitude; repository.Update(images); return(true); }