             else
               console.log err
               res.redirect 'shopmanagement/deals/list'
-      
+
    else
     fs.unlink file.path
     res.render "shopmanagement/deals/edit",

  format = type.split("/")
  if format[1] is "jpg" or format[1] is "jpeg" or format[1] is "png" or format[1] is "gif"
    fs.rename req.files.image.path, path, (err) ->
  
      Shop.findOne({_id: shopId}).exec (err, shop) ->

        if shop
          splittednewname = (file.path).split("/")
          image = "/upload/" + splittednewname[splittednewname.length-1]
          deal = new Deal
            shop: shop

        }
      )
  )

exports.editDo = (req, res) ->
  shopId = req.session.currentShop.shopId
  dealId = req.params.dealId
