public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ContractHour contractHour = await db.ContractHours.FindAsync(id);

            db.ContractHours.Remove(contractHour);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Transaction_ID,Property_ID,Contract_ID,Weekday,DailyHours,HoursUpdatedDate,WeeklyHours,AvgMonthlyHours")] ContractHour contractHour)
 {
     if (ModelState.IsValid)
     {
         db.MarkAsModified(contractHour);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Contract_ID = new SelectList(db.ContractDetail, "Contract_ID", "PriceDescription", contractHour.Contract_ID);
     ViewBag.Property_ID = new SelectList(db.Property, "Property_ID", "Prop_Address", contractHour.Property_ID);
     return(View(contractHour));
 }
예제 #3
0
        public async Task <ActionResult> Edit([Bind(Include = "Transaction_ID,Property_ID,Contract_ID,Weekday,DailyHours,HoursUpdatedDate,WeeklyHours,AvgMonthlyHours")] ContractHour contractHours)
        {
            if (ModelState.IsValid)
            {
                db.Entry(contractHours).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.Contract_ID = new SelectList(db.ContractDetails, "Contract_ID", "PriceDescription", contractHours.Contract_ID);
            ViewBag.Property_ID = new SelectList(db.Property, "Property_ID", "Prop_Address", contractHours.Property_ID);
            return(View(contractHours));
        }
예제 #4
0
        // GET: ContractHours/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ContractHour contractHours = await db.ContractHours.FindAsync(id);

            if (contractHours == null)
            {
                return(HttpNotFound());
            }
            return(View(contractHours));
        }
예제 #5
0
        // GET: ContractHours/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ContractHour contractHours = await db.ContractHours.FindAsync(id);

            if (contractHours == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Contract_ID = new SelectList(db.ContractDetails, "Contract_ID", "PriceDescription", contractHours.Contract_ID);
            ViewBag.Property_ID = new SelectList(db.Property, "Property_ID", "Prop_Address", contractHours.Property_ID);
            return(View(contractHours));
        }
        public ActionResult CalcVariableDays(ContractHour calc)
        {
            if (ModelState.IsValid)
            {
                // No errors added to ModelState
                // Get a value for the current year.(int)
                calc.CurrentYear = calc.GetCurrentYear();
                //Calculate if it is a leap year. (Bool)
                calc.LeapYear = calc.GetLeapYear(calc.CurrentYear);
                //Calculate what day xmas falls on in the current year.(String)
                calc.Xmasday = calc.Calcxmasday(calc.CurrentYear);
                //Calculate what day St Stephens day falls on in the current year (Day 366).(String)
                calc.Boxingday = calc.Calcboxingday(calc.CurrentYear);
                //Calculate what day New Years falls on in the current year (Day 365).(String)
                calc.Day365 = calc.Calc365day(calc.CurrentYear);
                //Calculate what day is after New Years day falls on in the current year (Day 366).(String)
                calc.Day366 = calc.Calc366day(calc.CurrentYear);

                return(RedirectToAction("Answer", calc));
            }
            // Show the form again (for correction)
            return(View(calc));
        }