Пример #1
0
 public ActionResult AddPigstyEquipMentInfo(PigstyModel model)
 {
     var pigstyService = new PigstyService();
     var pigsty = new pigsty
                      {
                          Number = model.Number,
                          PigHouseId = model.PigHouseId,
                          RFID = model.Rfid,
                          Memo = model.Memo,
                          Capacity = model.Capacity
                      };
     pigstyService.Insert(pigsty);
     ViewBag.Title = "添加成功";
     return View("PigstyMessage");
 }
 public ActionResult BatchAddPigsties(BatchAddPigstiesModel models)
 {
     try
     {
         var pigstyService = new PigstyService();
         foreach (AddPigstiesModel model in models.AddPigstiesModels)
         {
             var pigsty = new pigsty
                              {
                                  RFID = model.Rfid,
                                  Number = model.PigstyNumber,
                                  PigHouseId = models.PigHouseId,
                                  Capacity = model.Capacity
                              };
             pigstyService.Insert(pigsty);
         }
     }
     catch
     {
         Response.Write("<script language='JavaScript'>alert('有误!!');history.go(0);</script>");
     }
     ViewBag.Title = "成功导入";
     return View("Message");
 }