Beispiel #1
0
        public ActionResult List(string search, string orderByUserName)
        {
            var getDate   = new ServiceDate();
            var userinfos = getDate.ListUserName(search, orderByUserName);

            return(View(userinfos));
        }
 /// <summary>
 /// Displays invoice item on console
 /// </summary>
 public void DisplayItem()
 {
     Console.WriteLine($"{ServiceDate.DayOfWeek.ToString(),-10} {ServiceDate.ToShortDateString(),-10}\t|\t" +
                       $"{this.ServiceDelivered,-10}\t|\t" +
                       $"{this.ServiceHours}\t|\t" +
                       $"R{this.ServiceRate:0.00}\t\t|\t" +
                       $"R{this.ServiceCost:0.00}");
 }
 public override string ToString()
 {
     return($"Date: {ServiceDate.ToShortDateString()}, " +
            $"Service: {this.ServiceDelivered}, " +
            $"Hours: {this.ServiceHours}, " +
            $"Rate: R{this.ServiceRate:0.00} per hour, " +
            $"Cost: R{this.ServiceCost:0.00}");
 }
Beispiel #4
0
        public ActionResult DeleteUserName(int identif)
        {
            var getDate = new ServiceDate();

            getDate.DeleteUser(identif);

            return(Redirect("/List"));
        }
Beispiel #5
0
        public ActionResult DeleteGet(int identif)
        {
            var getDate = new ServiceDate();

            var userInfo = getDate.SeachID(identif);

            return(View("DeleteUserName", userInfo));
        }
Beispiel #6
0
        public ActionResult Edit(int identif)
        {
            var getDate = new ServiceDate();

            var userInfo = getDate.SeachID(identif);

            return(View(userInfo));
        }
Beispiel #7
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ServiceDate serviceDate = await db.ServiceDates.FindAsync(id);

            db.ServiceDates.Remove(serviceDate);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Beispiel #8
0
        public ActionResult Index(string username, UserInfo userInfo)
        {
            var getDate = new ServiceDate();

            getDate.InjectUserName(username);

            return(RedirectToAction(nameof(Confirmation),
                                    new { UserName = userInfo.UserName }));
        }
Beispiel #9
0
        public async Task <ActionResult> Edit([Bind(Include = "id,serviceId,date,exceptionNum")] ServiceDate serviceDate)
        {
            if (ModelState.IsValid)
            {
                db.Entry(serviceDate).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.serviceId = new SelectList(db.Services, "id", "id", serviceDate.serviceId);
            return(View(serviceDate));
        }
Beispiel #10
0
        public ActionResult Edit(string username, int identif)
        {
            var getDate = new ServiceDate();

            var userInfo = getDate.SeachID(identif);

            userInfo.UserName = username;

            getDate.UpdateUser(username, identif);

            return(Redirect("/List"));
        }
Beispiel #11
0
        // GET: ServiceDates/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ServiceDate serviceDate = await db.ServiceDates.FindAsync(id);

            if (serviceDate == null)
            {
                return(HttpNotFound());
            }
            return(View(serviceDate));
        }
Beispiel #12
0
        // GET: ServiceDates/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ServiceDate serviceDate = await db.ServiceDates.FindAsync(id);

            if (serviceDate == null)
            {
                return(HttpNotFound());
            }
            ViewBag.serviceId = new SelectList(db.Services, "id", "id", serviceDate.serviceId);
            return(View(serviceDate));
        }
        /// <summary>
        ///     Adds date to specific course
        /// </summary>
        /// <param name="courseId">Id of course to which date is added</param>
        /// <param name="date">Date to add</param>
        /// <returns>Success</returns>
        public async Task <bool> AddDateToService(int courseId, DateTime date)
        {
            try
            {
                using (var data = Context)
                {
                    var serviceDate = new ServiceDate
                    {
                        date      = date,
                        serviceID = courseId
                    };
                    data.Service.First(s => s.id == courseId).ServiceDate.Add(serviceDate);
                    await data.SaveChangesAsync();

                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
 public string Comments()
 {
     return($"Service date: {ServiceDate.ToShortDateString() }");
 }
Beispiel #15
0
 public string GetServiceDate()
 {
     return(ServiceDate.ToString());
 }