Exemplo n.º 1
0
        protected void rptProject_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "delete":
                wr.Delete(Convert.ToInt32(e.CommandArgument));
                GetProject();
                break;

            case "update":
                Response.Redirect(string.Format("~/AdminPanel/Work/WorkUpdate.aspx?ProjeId={0}", e.CommandArgument));
                break;
            }
        }
        public ActionResult <Work> DeleteMyFacilityWorker(int facilityID, int workID)
        {
            User user = UserRep.FindByEmail(User.Identity.Name);
            Work work = WorkRep.Find(workID);

            if (work != null)
            {
                return(NotFound());
            }
            else if (work.FacilityID != facilityID)
            {
                return(new ForbidResult());
            }
            else if (FacilityRep.IsAdmin(user, work.Facility))
            {
                WorkRep.Delete(workID);
                return(Ok());
            }
            else
            {
                return(new ForbidResult());
            }
        }