Exemplo n.º 1
0
        public bool Delete(StaffMemberModel staffMemberModel)
        {
            var  body = JsonConvert.SerializeObject(staffMemberModel);
            bool StaffMemberDelete = ServerResponse.Invoke <bool>("api/staffMember/Delete?id=" + staffMemberModel.Id, body, "POST");

            return(StaffMemberDelete);
        }
Exemplo n.º 2
0
        public bool Create(StaffMemberModel staffMemberModel)
        {
            var  body = JsonConvert.SerializeObject(staffMemberModel);
            bool StaffMemberCreate = ServerResponse.Invoke <bool>("api/staffMember/create", body, "Post");

            return(StaffMemberCreate);
        }
Exemplo n.º 3
0
        public bool Edit(StaffMemberModel staffMemberModel)
        {
            var  body            = JsonConvert.SerializeObject(staffMemberModel);
            bool StaffMemberEdit = ServerResponse.Invoke <bool>("api/staffMember/edit?id=" + staffMemberModel.Id, body, "POST");

            return(StaffMemberEdit);
        }
Exemplo n.º 4
0
        public ActionResult Edit(StaffMemberModel staffMember, HttpPostedFileBase file)
        {
            if (file != null)
            {
                var allowedExtensions = new[] { ".jfif", ".Jpg", ".png", ".jpg", "jpeg" };
                staffMember.ProfilePic = file.ToString();
                var fileName = Path.GetFileName(file.FileName);
                var ext      = Path.GetExtension(file.FileName);
                if (allowedExtensions.Contains(ext))
                {
                    string name1   = Path.GetFileNameWithoutExtension(fileName); //getting file name without extension
                    string myfile1 = name1 + "_" + staffMember.Id + ext;         //appending the name with id                                                                              // store the file inside ~/project folder(Img)
                    var    path    = Path.Combine(Server.MapPath("~/Image/StaffMember"), myfile1);
                    var    path1   = myfile1;
                    staffMember.ProfilePic = path1;
                    file.SaveAs(path);
                }
            }
            else
            {
                var getImage = Services.StaffMemberService.GetById(staffMember.Id);
                staffMember.ProfilePic = getImage.ProfilePic;
            }
            bool staff = Services.StaffMemberService.Edit(staffMember);

            TempData["Success"] = "Data Saved successfully!";
            return(RedirectToAction("Index", "StaffMember"));

            //  return View(staffMember);
        }
Exemplo n.º 5
0
        public StaffMemberModel GetByIdLogCheckDetails(int?id)
        {
            var body = "";
            StaffMemberModel StaffMemberId = ServerResponse.Invoke <StaffMemberModel>("api/staffMember/LogCheckDetails?id=" + id, body, "get");

            return(StaffMemberId);
        }
Exemplo n.º 6
0
        public ActionResult Create(StaffMemberModel staffMember, HttpPostedFileBase file)
        {
            var errors = ModelState.Values.SelectMany(v => v.Errors);

            if (ModelState.IsValid)
            {
                if (file != null)
                {
                    var allowedExtensions = new[] { ".jfif", ".Jpg", ".png", ".jpg", "jpeg" };
                    staffMember.ProfilePic = file.ToString();
                    var fileName = Path.GetFileName(file.FileName);
                    var ext      = Path.GetExtension(file.FileName);
                    if (allowedExtensions.Contains(ext))
                    {
                        string name1   = Path.GetFileNameWithoutExtension(fileName);                   //getting file name without extension
                        string myfile1 = name1 + "_" + staffMember.Id + ext;                           //appending the name with id
                        var    path    = Path.Combine(Server.MapPath("~/Image/StaffMember"), myfile1); // store the file inside ~/project folder(Img)
                        var    path1   = myfile1;
                        staffMember.ProfilePic = path1;
                        file.SaveAs(path);
                    }
                }


                staffMember.IsActive = true;
                bool StaffMemberCreate = Services.StaffMemberService.Create(staffMember);
                TempData["Success"] = "Data Saved Successfully!";
                return(RedirectToAction("Index", "StaffMember"));
            }
            return(View(staffMember));
        }
Exemplo n.º 7
0
 public ActionResult DeleteConfirmed(StaffMemberModel staffMember)
 {
     if (staffMember.Id > 0)
     {
         bool StaffMemberDelete = Services.StaffMemberService.Delete(staffMember);
         TempData["Success"] = "Data saved successfully!";
         return(RedirectToAction("Index", "StaffMember"));
     }
     return(View(staffMember));
 }
Exemplo n.º 8
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StaffMemberModel StaffMemberModelById = Services.StaffMemberService.GetById(id);

            if (StaffMemberModelById == null)
            {
                return(HttpNotFound());
            }
            return(View(StaffMemberModelById));
        }
Exemplo n.º 9
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            List <UserModel> UserModelList = Services.UserService.GetAll();

            ViewBag.UserId = new SelectList(UserModelList, "Id", "FullName");
            List <StaffStatusModel> StaffStatusModelList = Services.StaffStatusService.GetAll();

            ViewBag.StaffStatusId = new SelectList(StaffStatusModelList, "Id", "StatusName");
            StaffMemberModel StaffMemberModelById = Services.StaffMemberService.GetById(id);

            return(View(StaffMemberModelById));
        }
Exemplo n.º 10
0
 public bool Disable(StaffMemberModel model)
 {
     return(ServerResponse.Invoke <bool>("api/staffMember/disable", JsonConvert.SerializeObject(model), "POST"));
 }
Exemplo n.º 11
0
        public ActionResult EnableChechk(StaffMemberModel model)
        {
            bool status = Services.StaffMemberService.Enable(model);

            return(RedirectToAction("Index", "StaffMember"));
        }