Esempio n. 1
0
        public IActionResult Get(string id)
        {
            DataAccess accessor      = new DataAccess();
            hop        currentRecipe = accessor.Get <hop>(id);

            return(Json(currentRecipe));
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            hop hop = db.hops.Find(id);

            db.hops.Remove(hop);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "id,name,alpha,amount,use,time,notes,htype,form,beta,hsi,origin,substitutes,humulene,caryophyllene,cohumulone,myrcene,display_unit,display_scale,deleted,display,folder")] hop hop)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hop).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(hop));
 }
Esempio n. 4
0
        public IActionResult Post([FromBody] hop value, string id)
        {
            //double ibu = MathFunctions.IBU.basicIBU(value, 1.07);

            DataAccess accessor = new DataAccess();

            value = GlobalFunctions.AddIdIfNeeded(value, id);

            return(Json(accessor.Post(value)));
        }
Esempio n. 5
0
        // GET: hops/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            hop hop = db.hops.Find(id);

            if (hop == null)
            {
                return(HttpNotFound());
            }
            return(View(hop));
        }
Esempio n. 6
0
        public List <hopAddition> mapHopAdditions(List <hopObj> Hops)
        {
            List <hopAddition> hopAdditions = new List <hopAddition>();

            foreach (hopObj h in Hops)
            {
                hop hp = new hop();
                hp.aau    = h.ALPHA == null ? 0 : h.ALPHA.Value;
                hp.name   = h.NAME;
                hp.beta   = h.BETA == null ? 0 : h.BETA.Value;
                hp.origin = h.ORIGIN;
                hp.notes  = h.NOTES;

                hopAddition addition = new hopAddition();
                addition.additionGuid = Guid.NewGuid().ToString();
                addition.time         = (float)h.TIME.Value;
                addition.type         = h.USE;
                addition.amount       = (float)Math.Round(h.AMOUNT.Value * KGtoOZ, 2);//Amount is in kilograms
                addition.hop          = hp;

                hopAdditions.Add(addition);
            }
            return(hopAdditions);
        }
Esempio n. 7
0
 public void Méloée(hop hop)
 {
 }