Esempio n. 1
0
        public JsonResult RegisterVeterinary(RegisterVeterinaryJsonObject json)
        {
            var newVeterinary = new Veterinary();
            var msg           = "error";

            if (context.User.Find(json.VeterinaryId) != null)
            {
                using (var trans = new TransactionScope())
                {
                    newVeterinary.VeterinaryId    = json.VeterinaryId;
                    newVeterinary.Name            = json.Name;
                    newVeterinary.PresentationVid = json.DescripVid;
                    newVeterinary.PhoneNumber     = json.PhoneNumber;
                    newVeterinary.Latitude        = json.Latitude;
                    newVeterinary.Longitude       = json.Longitude;
                    newVeterinary.OpeningHours    = json.OpeningHours;
                    newVeterinary.Rate            = json.Rating;
                    context.Veterinary.Add(newVeterinary);
                    context.SaveChanges();
                    trans.Complete();
                }
                msg = "done";
            }
            return(Json(new { status = msg, veterinary = json }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        // GET: Veterinary
        public JsonResult veterinaries()


        {
            var sux = RegisterVeterinaryJsonObject.from(context.Veterinary.ToList());

            return(Json(new { status = "ok", veterinaries = sux }, JsonRequestBehavior.AllowGet));
        }