public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ChlorophyllSample chlorophyllSample = await db.ChlorophyllSamples.FindAsync(id);

            db.ChlorophyllSamples.Remove(chlorophyllSample);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> Edit([Bind(Include = "SampleId,Lake,Site,TimeEntered,Parameter,EntryCode,Result,Unit")] ChlorophyllSample chlorophyllSample)
        {
            if (ModelState.IsValid)
            {
                db.Entry(chlorophyllSample).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(chlorophyllSample));
        }
예제 #3
0
        public async Task <ActionResult> Create([Bind(Include = "SampleId,Lake,Site,TimeEntered,Parameter,EntryCodes,Result,Unit")] ChlorophyllSample chlorophyllSample)
        {
            if (ModelState.IsValid)
            {
                db.ChloropyllSamples.Add(chlorophyllSample);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(chlorophyllSample));
        }
        // GET: ChlorophyllSamples/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ChlorophyllSample chlorophyllSample = await db.ChlorophyllSamples.FindAsync(id);

            if (chlorophyllSample == null)
            {
                return(HttpNotFound());
            }
            return(View(chlorophyllSample));
        }
        public async Task <ActionResult> Create([Bind(Include = "SampleId,Lake,Site,TimeEntered,Parameter,EntryCode,Result,Unit,UserId")] ChlorophyllSample chlorophyllSample)
        {
            if (ModelState.IsValid)
            {
                var             userid      = User.Identity.GetUserId();
                ApplicationUser currentuser = db.Users.SingleOrDefault(t => t.Id == userid);
                chlorophyllSample.ApplicationUser = currentuser;
                db.ChlorophyllSamples.Add(chlorophyllSample);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(chlorophyllSample));
        }