Exemple #1
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));
        }
Exemple #2
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));
        }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "Id,Cell,Email,Name,Message")] Query query)
 {
     if (ModelState.IsValid)
     {
         db.Entry(query).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(query));
 }
 public ActionResult Edit([Bind(Include = "Id,V_Discount")] Voucher voucher)
 {
     if (ModelState.IsValid)
     {
         db.Entry(voucher).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(voucher));
 }
Exemple #5
0
 public ActionResult Edit([Bind(Include = "TicketId,Name")] tblTicket tblTicket)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblTicket).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblTicket));
 }
Exemple #6
0
 public ActionResult Edit([Bind(Include = "StaffID,StaffName,StaffEmail,SolveReport,PendingReport")] StaffWiseReport staffWiseReport)
 {
     if (ModelState.IsValid)
     {
         db.Entry(staffWiseReport).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(staffWiseReport));
 }
Exemple #7
0
 public ActionResult Edit([Bind(Include = "EmailId,From,To,Message")] tblEmail tblEmail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblEmail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblEmail));
 }
Exemple #8
0
 public ActionResult Edit([Bind(Include = "Id,Name,Amount")] Discount discount)
 {
     if (ModelState.IsValid)
     {
         db.Entry(discount).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(discount));
 }
 public ActionResult Edit([Bind(Include = "Id,Amount,Type,Code")] Payment payment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(payment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(payment));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,Total_Flat,Total_Floor,Lift,Generator,Address,Caretecar,CityId,Parking,Description")] Property property)
 {
     if (ModelState.IsValid)
     {
         db.Entry(property).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CityId = new SelectList(db.Cities, "Id", "Name", property.CityId);
     return(View(property));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,PropertyId")] PropertyImage propertyImage)
 {
     if (ModelState.IsValid)
     {
         db.Entry(propertyImage).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PropertyId = new SelectList(db.Properties, "Id", "Name", propertyImage.PropertyId);
     return(View(propertyImage));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,CountryId")] City city)
 {
     if (ModelState.IsValid)
     {
         db.Entry(city).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CountryId = new SelectList(db.Countries, "Id", "Name", city.CountryId);
     return(View(city));
 }
Exemple #13
0
 public ActionResult Edit([Bind(Include = "Id,Name,FlatId")] FlatImage flatImage)
 {
     if (ModelState.IsValid)
     {
         db.Entry(flatImage).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FlatId = new SelectList(db.Flats, "Id", "Name", flatImage.FlatId);
     return(View(flatImage));
 }
Exemple #14
0
 public ActionResult Edit([Bind(Include = "AssignedId,TicketId,StaffName,Email")] tblAssigned tblAssigned)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblAssigned).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TicketId = new SelectList(db.tblTickets, "TicketId", "Name", tblAssigned.TicketId);
     return(View(tblAssigned));
 }
 public ActionResult Edit([Bind(Include = "CommentsId,TicketId,Name,Comments")] tblComment tblComment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblComment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TicketId = new SelectList(db.tblTickets, "TicketId", "Name", tblComment.TicketId);
     return(View(tblComment));
 }
Exemple #16
0
 public ActionResult Edit([Bind(Include = "SubmitTicketId,TicketId,Name,Email,Subject,Priority,Attachment,Message")] tblSubmitTicket tblSubmitTicket)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblSubmitTicket).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TicketId = new SelectList(db.tblTickets, "TicketId", "Name", tblSubmitTicket.TicketId);
     return(View(tblSubmitTicket));
 }
 public ActionResult Edit([Bind(Include = "Id,RentId,Payment_Code,DataTime,Amount")] Rent_Payment rent_Payment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rent_Payment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RentId = new SelectList(db.Rents, "Id", "Id", rent_Payment.RentId);
     return(View(rent_Payment));
 }
Exemple #18
0
 public ActionResult Edit([Bind(Include = "Id,Name,Address,Contact,Email,Password,NId_orPassport,CityId,UserTypeId")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         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));
 }
 public ActionResult Edit([Bind(Include = "Id,FlatId,UserId,Price,Paper,Contact")] Rent rent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rent).State = EntityState.Modified;
         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));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,Size,Total_Room,BedRoom,Kichen,WashRoom,Dining,Draining,Corridor,Position,Floor_No,Complete,Description,Sold,Price,PropertyId,DiscountId,FlatTypeId")] Flat flat)
 {
     if (ModelState.IsValid)
     {
         db.Entry(flat).State = EntityState.Modified;
         db.SaveChanges();
         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));
 }
Exemple #21
0
 public ActionResult Edit([Bind(Include = "Id,FlatId,UserId,VoucherId,All_Paper,Description,PaymentId")] Buy_Sell buy_Sell)
 {
     if (ModelState.IsValid)
     {
         db.Entry(buy_Sell).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FlatId    = new SelectList(db.Flats, "Id", "Name", buy_Sell.FlatId);
     ViewBag.PaymentId = new SelectList(db.Payments, "Id", "Type", buy_Sell.PaymentId);
     ViewBag.UserId    = new SelectList(db.Users, "Id", "Name", buy_Sell.UserId);
     ViewBag.VoucherId = new SelectList(db.Vouchers, "Id", "Id", buy_Sell.VoucherId);
     return(View(buy_Sell));
 }
Exemple #22
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));
        }
Exemple #23
0
        public IHttpActionResult PutCategory(int id, Category model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

            try
            {
                db.SaveChanges();
                return(Ok(new
                {
                    success = true,
                    message = "Kategori Güncelleme işlemi başarılı"
                }));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!db.Categories.Any(x => x.CategoryID == id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }