Example #1
0
        public IActionResult CreateEquipment(EquipmentEditModel e)
        {
            if (ModelState.IsValid)
            {
                if (EquipmentRepository.Exist(e.EquipmentName))
                {
                    ViewBag.EquipmentExist = "The Equipment Exist";
                }
                else
                {
                    var k = new Equipment
                    {
                        EquipmentName = e.EquipmentName,
                        EquipmentType = e.EquipmentType,
                        EquipmentDate = DateTime.Parse(e.EquipmentDate)
                    };
                    EquipmentRepository.Add(k);
                    EquipmentRepository.Commit();


                    HttpContext.Session.SetString("Equipment", "Successfully created these equipment");
                    return(RedirectToAction("CreateEquipment"));
                }
            }
            return(View());
        }
Example #2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Library.Model.Equipment model)
 {
     return(dal.Add(model));
 }