Пример #1
0
 public ActionResult EditPourDetail(PourDetailView model)
 {
     try
     {
         Mark mark = CarraraSQL.Marks.Find(model.MarkID);
         mark.JobID      = model.JobID;
         mark.MarkNumber = model.MarkNumber;
         mark.Width      = model.Width;
         mark.Length     = model.Length;
         mark.Thickness  = model.Thickness;
         mark.MarkTypeID = model.MarkTypeID;
         mark.Weight     = model.Weight;
         mark.SquareFeet = model.SquareFeet;
         PourDetail pourDetail = CarraraSQL.PourDetails.Find(model.PourDetailID);
         pourDetail.Quantity  = model.Quantity;
         pourDetail.MarkRange = model.MarkRange;
         pourDetail.Camber    = model.Camber;
         CarraraSQL.SaveChanges();
         return(Content("OK", "text/plain"));
     }
     catch (Exception ex)
     {
         string message = ex.Message;
         if (ex.InnerException != null)
         {
             message = ex.InnerException.Message;
         }
         return(Content(string.Concat("Whoops…", message), "text/plain"));
     }
 }
Пример #2
0
 public ActionResult AddPourDetail(PourDetailView model)
 {
     try
     {
         Mark mark = new Mark
         {
             JobID      = model.JobID,
             MarkNumber = model.MarkNumber,
             Width      = model.Width,
             Length     = model.Length,
             Thickness  = model.Thickness,
             MarkTypeID = model.MarkTypeID,
             Weight     = model.Weight,
             SquareFeet = model.SquareFeet
         };
         CarraraSQL.Marks.Add(mark);
         PourDetail pourDetail = new PourDetail
         {
             Quantity  = model.Quantity,
             MarkRange = model.MarkRange,
             Camber    = model.Camber,
             MarkID    = mark.MarkID,
             PourID    = model.PourID
         };
         CarraraSQL.PourDetails.Add(pourDetail);
         CarraraSQL.SaveChanges();
         Pour pour = CarraraSQL.Pours.Find(model.PourID);
         return(PartialView("_PourDetail", new PourDetail
         {
             PourID = model.PourID,
             Pour = pour,
             DefaultJobID = pour.DefaultJobID,
             DefaultMarkTypeID = pour.DefaultMarkTypeID
         }));
     }
     catch (Exception ex)
     {
         string message = ex.Message;
         if (ex.InnerException != null)
         {
             message = ex.InnerException.Message;
         }
         return(Content(string.Concat("Whoops…", message), "text/plain"));
     }
 }
Пример #3
0
 public ActionResult DeletePourDetail(int guid)
 {
     try
     {
         PourDetail pourDetail = CarraraSQL.PourDetails.Find(guid);
         Mark       mark       = CarraraSQL.Marks.Find(pourDetail.MarkID);
         CarraraSQL.Marks.Remove(mark);
         CarraraSQL.PourDetails.Remove(pourDetail);
         CarraraSQL.SaveChanges();
         return(Content("OK", "text/plain"));
     }
     catch (Exception ex)
     {
         string message = ex.Message;
         if (ex.InnerException != null)
         {
             message = ex.InnerException.Message;
         }
         return(Content(string.Concat("Whoops…", message), "text/plain"));
     }
 }