Пример #1
0
        public IHttpActionResult PutCategory(int id, Category category)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != category.CategoryID)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CategoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public IHttpActionResult PutProduct(int id, Product product)    // Güncelleme işlemi
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != product.ProductID)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #3
0
        public ActionResult Create([Bind(Include = "StaffID,StaffName,StaffEmail,SolveReport,PendingReport")] StaffWiseReport staffWiseReport)
        {
            if (ModelState.IsValid)
            {
                db.StaffWiseReports.Add(staffWiseReport);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(staffWiseReport));
        }
Пример #4
0
        public ActionResult Create([Bind(Include = "TicketId,Name")] tblTicket tblTicket)
        {
            if (ModelState.IsValid)
            {
                db.tblTickets.Add(tblTicket);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblTicket));
        }
Пример #5
0
        public ActionResult Create([Bind(Include = "Id,Name")] Country country)
        {
            if (ModelState.IsValid)
            {
                db.Countries.Add(country);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(country));
        }
Пример #6
0
        public ActionResult Create([Bind(Include = "EmailId,From,To,Message")] tblEmail tblEmail)
        {
            if (ModelState.IsValid)
            {
                db.tblEmails.Add(tblEmail);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblEmail));
        }
Пример #7
0
        public ActionResult Create([Bind(Include = "Id,Name,Amount")] Discount discount)
        {
            if (ModelState.IsValid)
            {
                db.Discounts.Add(discount);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(discount));
        }
Пример #8
0
        public ActionResult QureyCreate([Bind(Include = "Id,Cell,Email,Name,Message")] Query query)
        {
            if (ModelState.IsValid)
            {
                db.Queries.Add(query);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(query));
        }
Пример #9
0
        public ActionResult Create([Bind(Include = "Id,Amount,Type,Code")] Payment payment)
        {
            if (ModelState.IsValid)
            {
                db.Payments.Add(payment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(payment));
        }
Пример #10
0
        public ActionResult Create([Bind(Include = "Id,V_Discount")] Voucher voucher)
        {
            if (ModelState.IsValid)
            {
                db.Vouchers.Add(voucher);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(voucher));
        }
Пример #11
0
        public ActionResult Create([Bind(Include = "Id,Name,Total_Flat,Total_Floor,Lift,Generator,Address,Caretecar,CityId,Parking,Description")] Property property)
        {
            if (ModelState.IsValid)
            {
                db.Properties.Add(property);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CityId = new SelectList(db.Cities, "Id", "Name", property.CityId);
            return(View(property));
        }
        public ActionResult Create([Bind(Include = "CommentsId,TicketId,Name,Comments")] tblComment tblComment)
        {
            if (ModelState.IsValid)
            {
                db.tblComments.Add(tblComment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.TicketId = new SelectList(db.tblTickets, "TicketId", "Name", tblComment.TicketId);
            return(View(tblComment));
        }
        public ActionResult Create([Bind(Include = "Id,RentId,Payment_Code,DataTime,Amount")] Rent_Payment rent_Payment)
        {
            if (ModelState.IsValid)
            {
                db.Rent_Payment.Add(rent_Payment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.RentId = new SelectList(db.Rents, "Id", "Id", rent_Payment.RentId);
            return(View(rent_Payment));
        }
Пример #14
0
        public ActionResult Create([Bind(Include = "Id,Name,CountryId")] City city)
        {
            if (ModelState.IsValid)
            {
                db.Cities.Add(city);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CountryId = new SelectList(db.Countries, "Id", "Name", city.CountryId);
            return(View(city));
        }
Пример #15
0
        public ActionResult Create([Bind(Include = "AssignedId,TicketId,StaffName,Email")] tblAssigned tblAssigned)
        {
            if (ModelState.IsValid)
            {
                db.tblAssigneds.Add(tblAssigned);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.TicketId = new SelectList(db.tblTickets, "TicketId", "Name", tblAssigned.TicketId);
            return(View(tblAssigned));
        }
Пример #16
0
        public ActionResult Create([Bind(Include = "Id,FlatId,UserId,Price,Paper,Contact")] Rent rent)
        {
            if (ModelState.IsValid)
            {
                db.Rents.Add(rent);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.FlatId = new SelectList(db.Flats, "Id", "Name", rent.FlatId);
            ViewBag.UserId = new SelectList(db.Users, "Id", "Name", rent.UserId);
            return(View(rent));
        }
Пример #17
0
        public ActionResult Create([Bind(Include = "Id,Name,Address,Contact,Email,Password,NId_orPassport,CityId,UserTypeId")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CityId     = new SelectList(db.Cities, "Id", "Name", user.CityId);
            ViewBag.UserTypeId = new SelectList(db.UserTypes, "Id", "Name", user.UserTypeId);
            return(View(user));
        }
Пример #18
0
        //[ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "SubmitTicketId,TicketId,Name,Email,Subject,Priority,Attachment,Message")] tblSubmitTicket tblSubmitTicket, HttpPostedFileBase fleFile)
        {
            if (ModelState.IsValid)
            {
                tblSubmitTicket.Attachment = System.IO.Path.GetFileName(fleFile.FileName);
                db.tblSubmitTickets.Add(tblSubmitTicket);
                db.SaveChanges();
                fleFile.SaveAs(Server.MapPath("../Uploads/File/" + tblSubmitTicket.SubmitTicketId.ToString() + "_" + tblSubmitTicket.Attachment));
                return(RedirectToAction("Index"));
            }

            ViewBag.TicketId = new SelectList(db.tblTickets, "TicketId", "Name", tblSubmitTicket.TicketId);
            return(View(tblSubmitTicket));
        }
Пример #19
0
        public ActionResult Create(FlatImage flatImage, HttpPostedFileBase Image)
        {
            flatImage.Name = System.IO.Path.GetFileName(Image.FileName);
            if (ModelState.IsValid)
            {
                db.FlatImages.Add(flatImage);
                db.SaveChanges();
                Image.SaveAs(Server.MapPath("../Upload/FlatImage/" + flatImage.Id.ToString() + "_" + Image.FileName));
                return(RedirectToAction("Index"));
            }

            ViewBag.FlatId = new SelectList(db.Flats, "Id", "Name", flatImage.FlatId);
            return(View(flatImage));
        }
Пример #20
0
        public ActionResult Create(UserImage userImage, HttpPostedFileBase Name)
        {
            userImage.Name = System.IO.Path.GetFileName(Name.FileName);

            if (ModelState.IsValid)
            {
                db.UserImages.Add(userImage);
                db.SaveChanges();
                Name.SaveAs(Server.MapPath("../Upload/usersImage/" + userImage.Id.ToString() + "_" + userImage.Name));
                return(RedirectToAction("Index"));
            }

            ViewBag.UserId = new SelectList(db.Users, "Id", "Name", userImage.UserId);
            return(View(userImage));
        }
Пример #21
0
 public IHttpActionResult Add([FromBody] CategoryViewModel model)
 {
     try
     {
         db.Categories.Add(new Category()
         {
             CategoryName = model.CategoryName,
             Description  = model.Description
         });
         db.SaveChanges();
         return(Ok(new {
             success = true,
             message = "Kategori ekleme işlemi başarılı"
         }));
     }
     catch (Exception ex)
     {
         return(BadRequest($"Bir hata oluştu {ex.Message}"));
     }
 }
Пример #22
0
        public ActionResult Bookings(Booking aBooking)
        {
            if (ModelState.IsValid)
            {
                Voucher aVoucher = new Voucher();
                aVoucher.V_Discount = aBooking.Discount;
                db.Vouchers.Add(aVoucher);
                db.SaveChanges();

                Payment aPayment = new Payment();
                aPayment.Amount    = aBooking.Amount;
                aPayment.Type      = aBooking.Type;
                aPayment.Code      = aBooking.Code;
                aPayment.VoucherId = aVoucher.Id;
                db.Payments.Add(aPayment);
                db.SaveChanges();

                Buy_Sell abuySell = new Buy_Sell();
                abuySell.FlatId      = aBooking.Id;
                abuySell.UserId      = Convert.ToInt32(Session["Id"].ToString());
                abuySell.VoucherId   = aVoucher.Id;
                abuySell.PaymentId   = aPayment.Id;
                abuySell.All_Paper   = false;
                abuySell.Description = "";
                db.Buy_Sell.Add(abuySell);
                db.SaveChanges();
                TempData["message"] = "Booing Successfully";
            }


            return(View());
        }
Пример #23
0
        public ActionResult Create(Property property, HttpPostedFileBase Image)
        {
            var img = System.IO.Path.GetFileName(Image.FileName);

            if (ModelState.IsValid)
            {
                db.Properties.Add(property);
                db.SaveChanges();
                PropertyImage pImage = new PropertyImage();
                pImage.PropertyId = property.Id;
                pImage.Name       = img;
                db.PropertyImages.Add(pImage);
                db.SaveChanges();
                //WebImage primg = new WebImage(Image.InputStream);
                //primg.Resize(400, 400);
                Image.SaveAs(Server.MapPath("../Upload/PropertyImage/" + property.Id.ToString() + "_" + img));
                return(RedirectToAction("Index"));
            }

            ViewBag.CityId = new SelectList(db.Cities, "Id", "Name", property.CityId);
            return(View(property));
        }
Пример #24
0
        public IHttpActionResult PutProduct(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var data = db.Products.Find(id);

            if (id != data.ProductID)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
                return(Ok(new
                {
                    message = "Güncelleme işlemi başarılı"
                }));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #25
0
        public ActionResult Create(Flat flat, HttpPostedFileBase Image)
        {
            var img = System.IO.Path.GetFileName(Image.FileName);

            if (ModelState.IsValid)
            {
                db.Flats.Add(flat);
                db.SaveChanges();

                FlatImage fImage = new FlatImage();
                fImage.FlatId = flat.Id;
                fImage.Name   = img;
                db.FlatImages.Add(fImage);
                db.SaveChanges();
                Image.SaveAs(Server.MapPath("../Upload/FlatImage/" + fImage.Id.ToString() + "_" + img));

                return(RedirectToAction("Index"));
            }

            ViewBag.DiscountId = new SelectList(db.Discounts, "Id", "Name", flat.DiscountId);
            ViewBag.FlatTypeId = new SelectList(db.FlatTypes, "Id", "Name", flat.FlatTypeId);
            ViewBag.PropertyId = new SelectList(db.Properties, "Id", "Name", flat.PropertyId);
            return(View(flat));
        }
Пример #26
0
        public ActionResult Register(ViewLogin reg)
        {
            User userReg = reg.UserReg;

            userReg.UserTypeId = 2;

            if (ModelState.IsValid)
            {
                db.Users.Add(userReg);

                db.SaveChanges();
                TempData["message"] = "Registered Successfully";
                return(RedirectToAction("Login"));
            }
            else
            {
                ViewBag.CityId      = db.Cities.ToList();
                TempData["message"] = "Required some value";
                return(RedirectToAction("Login", reg.UserReg));
            }
        }