public ActionResult Login(Usermast model)
 {
     if (ModelState.IsValid)
     {
         string Login_Name = string.Empty;
         var    LoginList  = new AccountApiController().GetLogin(model.Login_Name.Trim()).FirstOrDefault();
         if (LoginList != null)
         {
             if (LoginList.Password.Trim() == model.Password.Trim())
             {
                 while (LoginList.Name != null)
                 {
                     Session["EMPNAME"] = LoginList.Name;
                     Session["Code"]    = LoginList.Code.TrimEnd();
                     return(View("Home"));
                 }
             }
             else
             {
                 ModelState.AddModelError("", "User Name Or Password is incorrect!");
             }
         }
         else
         {
             ModelState.AddModelError("", "User Name Or Password s incorrect!");
         }
     }
     else
     {
         ModelState.AddModelError("", "User Name Or Password s incorrect!");
     }
     return(View());
 }
        public async Task <IHttpActionResult> PutUsermast(int id, Usermast usermast)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != usermast.Pid)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <Usermast> GetUsermast(int id)
        {
            Usermast usermast = await db.Usermasts.FindAsync(id);

            if (usermast == null)
            {
                return(null);
            }
            return(usermast);
        }
        public async Task <IHttpActionResult> PostUsermast(Usermast usermast)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            db.Usermasts.Add(usermast);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = usermast.Pid }, usermast));
        }
        public async Task <IHttpActionResult> DeleteUsermast(int id)
        {
            Usermast usermast = await db.Usermasts.FindAsync(id);

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

            db.Usermasts.Remove(usermast);
            await db.SaveChangesAsync();

            return(Ok(usermast));
        }