public async Task <IHttpActionResult> PutM_ContactMaster(int id, M_ContactMaster m_ContactMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != m_ContactMaster.ContactID)
            {
                return(BadRequest());
            }

            db.Entry(m_ContactMaster).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!M_ContactMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            M_ContactMaster m_ContactMaster = await db.M_ContactMaster.FindAsync(id);

            db.M_ContactMaster.Remove(m_ContactMaster);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <IHttpActionResult> GetM_ContactMaster(int id)
        {
            M_ContactMaster m_ContactMaster = await db.M_ContactMaster.FindAsync(id);

            if (m_ContactMaster == null)
            {
                return(NotFound());
            }

            return(Ok(m_ContactMaster));
        }
        public async Task <IHttpActionResult> PostM_ContactMaster(M_ContactMaster m_ContactMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.M_ContactMaster.Add(m_ContactMaster);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = m_ContactMaster.ContactID }, m_ContactMaster));
        }
        public async Task <IHttpActionResult> DeleteM_ContactMaster(int id)
        {
            M_ContactMaster m_ContactMaster = await db.M_ContactMaster.FindAsync(id);

            if (m_ContactMaster == null)
            {
                return(NotFound());
            }

            db.M_ContactMaster.Remove(m_ContactMaster);
            await db.SaveChangesAsync();

            return(Ok(m_ContactMaster));
        }
        // GET: M_ContactMaster/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (!CommonFunctions.CheckUserAuthentication())
            {
                return(RedirectToAction("Login", "Admin"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            M_ContactMaster m_ContactMaster = await db.M_ContactMaster.FindAsync(id);

            if (m_ContactMaster == null)
            {
                return(HttpNotFound());
            }
            return(View(m_ContactMaster));
        }
        public async Task <ActionResult> Edit([Bind(Include = "ContactID,PlacementNode,TelephoneNo,Email")] M_ContactMaster m_ContactMaster)
        {
            if (ModelState.IsValid)
            {
                m_ContactMaster.Address           = "NA";
                m_ContactMaster.Website           = "NA";
                m_ContactMaster.PlacementHeadName = "NA";
                m_ContactMaster.ContactNo         = "NA";
                m_ContactMaster.EmailID           = "NA";
                m_ContactMaster.Description       = "NA";
                m_ContactMaster.CreatedBy         = "Admin";
                m_ContactMaster.CreatedDate       = DateTime.Now;
                m_ContactMaster.ModifiedBy        = "Admin";
                m_ContactMaster.ModifiedDate      = DateTime.Now;
                m_ContactMaster.Active            = true;
                db.Entry(m_ContactMaster).State   = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(m_ContactMaster));
        }