// GET: COPR16_UNITS_MSTR/Edit/5
        public async Task <ActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            COPR16_UNITS_MSTR cOPR16_UNITS_MSTR = await db.COPR16_UNITS_MSTR.FindAsync(id);

            if (cOPR16_UNITS_MSTR == null)
            {
                return(HttpNotFound());
            }
            return(View(cOPR16_UNITS_MSTR));
        }
        public async Task <ActionResult> Edit([Bind(Include = "UNIT_ID,UNIT_NAME,ADATE,CRE_BY,MOD_BY,MOD_DATE,MUNIT_ID,FLGACT,UNIT_TEXT")] COPR16_UNITS_MSTR cOPR16_UNITS_MSTR)
        {
            string usr = System.Web.HttpContext.Current.User.Identity.Name.Substring(System.Web.HttpContext.Current.User.Identity.Name.IndexOf(@"\") + 1);

            if (ModelState.IsValid)
            {
                cOPR16_UNITS_MSTR.MOD_BY          = usr;
                cOPR16_UNITS_MSTR.MOD_DATE        = System.DateTime.Now;
                db.Entry(cOPR16_UNITS_MSTR).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(cOPR16_UNITS_MSTR));
        }
        public async Task <ActionResult> Create([Bind(Include = "UNIT_ID,UNIT_NAME,ADATE,CRE_BY,MOD_BY,MOD_DATE,MUNIT_ID,FLGACT,UNIT_TEXT")] COPR16_UNITS_MSTR cOPR16_UNITS_MSTR)
        {
            if (ModelState.IsValid)
            {
                string usr = System.Web.HttpContext.Current.User.Identity.Name.Substring(System.Web.HttpContext.Current.User.Identity.Name.IndexOf(@"\") + 1);
                cOPR16_UNITS_MSTR.CRE_BY = usr;

                db.COPR16_UNITS_MSTR.Add(cOPR16_UNITS_MSTR);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(cOPR16_UNITS_MSTR));
        }
        // GET: COPR16_UNITS_MSTR/Active/5
        public async Task <ActionResult> Active(string id)
        {
            string usr = System.Web.HttpContext.Current.User.Identity.Name.Substring(System.Web.HttpContext.Current.User.Identity.Name.IndexOf(@"\") + 1);

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            COPR16_UNITS_MSTR cOPR16_UNITS_MSTR = await db.COPR16_UNITS_MSTR.FindAsync(id);

            if (cOPR16_UNITS_MSTR == null)
            {
                return(HttpNotFound());
            }
            cOPR16_UNITS_MSTR.FLGACT   = true;
            cOPR16_UNITS_MSTR.MOD_BY   = usr;
            cOPR16_UNITS_MSTR.MOD_DATE = System.DateTime.Now;
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <JsonResult> GetUNITS(string id)
        {
            COPR16_UNITS_MSTR cOPR16_UNITS_MSTR = await db.COPR16_UNITS_MSTR.FindAsync(id);

            return(Json(cOPR16_UNITS_MSTR, JsonRequestBehavior.AllowGet));
        }