Beispiel #1
0
 public ActionResult EditRock(RockView model)
 {
     if (!ModelState.IsValid)
     {
         return(WriteStatusError(ModelState));
     }
     rockSer.EditWhere(x => x.Rock_ID == model.Rock_ID, model);
     rockSer.SaveChanges();
     return(WriteSuccess("修改成功"));
 }
Beispiel #2
0
        //
        // GET: /Rock/

        //public ActionResult Index()
        //{
        //    return View();
        //}
        //添加岩石信息
        public ActionResult AddRock(RockView model)
        {
            if (!ModelState.IsValid)
            {
                return(WriteStatusError(ModelState));
            }
            var modelRock = new Rock();

            modelRock.CopyFrom(model);
            rockSer.Add(modelRock);
            modelRock.Rock_ID = Guid.NewGuid().ToString();
            rockSer.SaveChanges();
            return(WriteSuccess("添加成功"));
        }