public IActionResult UpdatePlane(long hangerID, int planeID) { AmsHangar planeAllot = ams_report.AmsHangar.Where(p => p.HangarId == hangerID).FirstOrDefault(); planeAllot.PlaneAlloted = planeID; AmsPlane plane = ams_report.AmsPlane.Where(p => p.PlaneId == planeID).FirstOrDefault(); plane.HangerStatus = "Allotted"; ams_report.SaveChanges(); return(Ok("Updated")); }
public ActionResult PutPlane(int planeId, [FromBody] AmsPlane plane) { AmsPlane Plane = AMS1.AmsPlane.Where(p => p.PlaneId == planeId).FirstOrDefault(); Plane.OwnerId = plane.OwnerId; Plane.OwnerFirstName = plane.OwnerFirstName; Plane.OwnerLastName = plane.OwnerLastName; Plane.OwnerContactNumber = plane.OwnerContactNumber; Plane.OwnerEmail = plane.OwnerEmail; Plane.PlaneType = plane.PlaneType; Plane.PlaneCapacity = plane.PlaneCapacity; Plane.HangerStatus = "Not Allotted"; AMS1.SaveChanges(); return(Ok("Updated")); }
public IActionResult PostPlane([FromBody] AmsPlane planeId) { AmsPlane ams_plane = new AmsPlane(); ams_plane.OwnerId = AMS1.AmsPlane.Max(p => p.OwnerId) + 1; ams_plane.OwnerFirstName = planeId.OwnerFirstName; ams_plane.OwnerLastName = planeId.OwnerLastName; ams_plane.OwnerContactNumber = planeId.OwnerContactNumber; ams_plane.OwnerEmail = planeId.OwnerEmail; ams_plane.PlaneType = planeId.PlaneType; ams_plane.PlaneCapacity = planeId.PlaneCapacity; ams_plane.HangerStatus = "Not Allotted"; AMS1.AmsPlane.Add(ams_plane); AMS1.SaveChanges(); return(Ok("Plane added")); }