public ActionResult Create(file fi)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string filename = string.Empty;

                    if (fi.bookpdf != null)
                    {
                        string uploads = Path.Combine(_webHostEnvironment.WebRootPath, "uploads");
                        filename = fi.bookpdf.FileName;
                        string fullPath = Path.Combine(uploads, filename);
                        fi.bookpdf.CopyTo(new FileStream(fullPath, FileMode.Create));
                        ViewBag.type = fi.bookpdf.ContentType;
                    }
                    Book book = new Book
                    {
                        BookId     = fi.BookId,
                        bookName   = fi.bookName,
                        bookpdfurl = filename
                    };
                    books.Add(book);
                }
                return(RedirectToAction(nameof(List)));
            }
            catch
            {
                return(View());
            }
        }
Exemple #2
0
        public ActionResult Add()
        {
            var request = new OperationRequest();

            request.Number1 = 100;
            request.Number2 = 200;
            var response = _operations.Add(request);

            return(View(response));
        }
Exemple #3
0
 public static Func <int, int, T> MatrixMultiply <T>(Func <int, int, T> lhs, Func <int, int, T> rhs, int size, IOperations <T> operations)
 {
     return((i, j) =>
     {
         T value = operations.Zero;
         for (int k = 0; k < size; k++)
         {
             value = operations.Add(value, operations.Multiply(lhs(i, k), rhs(k, j)));
         }
         return value;
     });
 }
 public static T ScalarProduct <T>(Func <int, T> lhs, Func <int, T> rhs, int size, IOperations <T> operations)
 {
     return(VectorUtilities.ScalarProduct(lhs, rhs, size, operations.Zero, (x, y) => operations.Add(x, y), (x, y) => operations.Multiply(x, y)));
 }
Exemple #5
0
 public static Func <int, T> MatrixVectorMultiply <T>(Func <int, int, T> lhs, Func <int, T> rhs, int size, IOperations <T> operations)
 {
     return(MatrixUtilities.MatrixVectorMultiply(lhs, rhs, size, operations.Zero, (x, y) => operations.Add(x, y), (x, y) => operations.Multiply(x, y)));
 }